D1D839FD3A8A67CE3B1DDABBAFD821D4.jpg

pvc

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-ext-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "100Gi"
  volumeName: 
  storageClassName: nfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-data-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "100Gi"
  volumeName: 
  storageClassName: nfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-log-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "100Gi"
  volumeName: 
  storageClassName: nfs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: sonar-conf-pvc
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: "5Gi"
  volumeName: 
  storageClassName: nfs

deployment

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: sonarqube
  labels:
    name: sonarqube
spec:
  template:
    metadata:
      name: sonarqube
      labels:
        name: sonarqube
    spec:
      securityContext:
        fsGroup: 999
      containers:
      - name: sonarqube
        image: sonarqube:7.6-community
        imagePullPolicy: IfNotPresent
        env:
        - name: TZ
          value: "Asia/Shanghai"
        - name: SONARQUBE_JDBC_USERNAME
          value: "sonar"
        - name: SONARQUBE_JDBC_PASSWORD
          value: "1qaz@WSX"
        - name: SONARQUBE_JDBC_URL
          value: "jdbc:mysql://172.16.0.3:3306/sonardb?useSSL=false&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance"
        ports:
        - name: http
          containerPort: 9000
        volumeMounts:
        - name: sonar-ext
          mountPath: /opt/sonarqube/extensions
        - name: sonar-data
          mountPath: /opt/sonarqube/data
        - name: sonar-log
          mountPath: /opt/sonarqube/logs
        - name: sonar-conf
          mountPath: /opt/sonarqube/conf
      volumes:
        - name: sonar-ext
          persistentVolumeClaim:
            claimName: sonar-ext-pvc
        - name: sonar-data
          persistentVolumeClaim:
            claimName: sonar-data-pvc
        - name: sonar-log
          persistentVolumeClaim:
            claimName: sonar-log-pvc
        - name: sonar-conf
          persistentVolumeClaim:
            claimName: sonar-conf-pvc

service

apiVersion: v1
kind: Service
metadata:
  name: sonarqube
  labels:
    name: sonarqube
spec:
  type: NodePort
  ports:
    - name: http
      port: 9000
      nodePort: 30010
      targetPort: 9000
  selector:
    name: sonarqube

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code