首页 新闻 会员 周边 捐助

docker执行Jenkins正常,用kubernetes执行Jenkins却提示缺少插件

0
悬赏园豆:10 [待解决问题]

docker执行图

kubernetes执行图

用kubernetes部署Jenkins总提示缺少各种插件

kubernetes配置如下:


apiVersion: v1
kind: Namespace
metadata:
  name: jenkins
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: jenkins
  namespace: jenkins
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: jenkins-crb
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: jenkins
  namespace: jenkins
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins-master
  namespace: jenkins
spec:
  replicas: 1
  selector:
    matchLabels:
      devops: jenkins-master
  template:
    metadata:
      labels:
        devops: jenkins-master
    spec:
      nodeSelector:
        jenkins: "true"
      serviceAccount: jenkins
      initContainers:
      - name: fix-permissions
        image: busybox
        command: ["sh","-c","chown -R 1000:1000 /var/jenkins_home"]
        securityContext:
          privileged: true
        volumeMounts:
        - name: jenkinshome
          mountPath: /var/jenkins_home
      containers:
      - name: jenkins
        image: jenkins401:v1
        imagePullPolicy: IfNotPresent
        ports:
        - name: http
          containerPort: 8080
        - name: slavelistener
          containerPort: 50000
        volumeMounts:
        - name: jenkinshome
          mountPath: /var/jenkins_home
        env:
        - name: JAVA_OPTS
          value: "-Xms4096m -Xmx5120m -Duser.timezone=Asia/Shanghai -Dhudson.model.DirectoryBrowserSupport.CSP="
      volumes:
        - name: jenkinshome
          hostPath:
            path: /var/jenkins_home/
---
apiVersion: v1
kind: Service
metadata:
  name: jenkins
  namespace: jenkins
spec:
  ports:
    - name: http
      port: 8080
      targetPort: 8080
    - name: slavelistener
      port: 50000
      targetPort: 50000
  selector:
    devops: jenkins-master
---
apiVersion: networking.k8s.io/v1 # 或者 networking.k8s.io/v1,如果您的集群支持
kind: Ingress
metadata:
  name: jenkins-web
  namespace: jenkins
spec:
  rules:
    - host: jenkins.qq.com
      http:
        paths:
          - backend:
              service:
                name: jenkins
                port:
                  number: 8080
            path: /
            pathType: Prefix

没法放置代码块,大佬帮看看哪个配置有问题?
熊猫~·的主页 熊猫~· | 初学一级 | 园豆:171
提问于:2024-11-03 11:18

支持 markdown 语法,可以放代码块

dudu 3天前

@dudu: 我用··· 不生效

熊猫~· 3天前

@熊猫~·: 肯定可以,我用过很多次

dudu 3天前

@dudu: 可以了,感谢

熊猫~· 3天前
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册