kubernetes volumeMounts 挂载单文件

  sre

551182734AE112244FD75739944794A1.jpg

apiVersion: apps/v1
kind: Deployment
metadata:
  name: jenkins-master   
  namespace: cicd
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jenkins
  template:
    metadata:
      labels:
        app: jenkins
    spec:
      serviceAccount: jenkins            
      containers:
      - name: jenkins
        image: jenkins         


        volumeMounts:                    
        - name: jenkinsshare
          mountPath: /usr/share/jenkins/jenkins.war     
          subPath: jenkins.war
        - name: jenkinshome
          subPath: jenkins
          mountPath: /var/jenkins_home

      volumes:
      - name: jenkinsshare
        persistentVolumeClaim:
          claimName: jenkins-share
      - name: jenkinshome
        persistentVolumeClaim:
          claimName: jenkins-master    

LEAVE A COMMENT

Captcha Code