Sonarqube搭建代码
1apiVersion: extensions/v1beta1 2kind: Deployment 3metadata: 4 name: postgres 5 labels: 6 app: postgres 7spec: 8 template: 9 metadata: 10 name: postgres 11 labels: 12 app: postgres 13 spec: 14 containers: 15 - name: postgres 16 image: postgres:10 17 ports: 18 - containerPort: 5432 19 env: 20 - name: POSTGRES_USER 21 value: sonar 22 - name: POSTGRES_PASSWORD 23 value: sonar 24 volumeMounts: 25 - mountPath: /var/lib/postgresql/data 26 name: postgres-data 27 volumes: 28 - name: postgres-data 29 hostPath: 30 path: /data 31--- 32apiVersion: v1 33kind: Service 34metadata: 35 name: postgres 36 labels: 37 app: postgres 38spec: 39 type: NodePort 40 ports: 41 - port: 5432 42 selector: 43 app: postgres 44--- 45apiVersion: extensions/v1beta1 46kind: Deployment 47metadata: 48 name: sonar 49spec: 50 replicas: 1 51 template: 52 metadata: 53 labels: 54 app: sonar 55 spec: 56 containers: 57 - name: sonar 58 image: sonarqube:latest 59 ports: 60 - containerPort: 9000 61 env: 62 - name: SONARQUBE_JDBC_USERNAME 63 value: sonar 64 - name: SONARQUBE_JDBC_PASSWORD 65 value: sonar 66 - name: SONARQUBE_JDBC_URL 67 value: jdbc:postgresql://postgres:5432/sonar 68--- 69apiVersion: v1 70kind: Service 71metadata: 72 name: sonar 73spec: 74 type: NodePort 75 ports: 76 - port: 9000 77 nodePort: 30001 78 selector: 79 app: sonar