SonarQube install on Kubernetes

Sonarqube搭建代码

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  template:
    metadata:
      name: postgres
      labels:
        app: postgres
    spec:
      containers:
      - name: postgres
        image: postgres:10
        ports:
          - containerPort: 5432
        env:
          - name: POSTGRES_USER
            value: sonar
          - name: POSTGRES_PASSWORD
            value: sonar
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: postgres-data
      volumes:
      - name: postgres-data
        hostPath:
          path: /data
---
apiVersion: v1
kind: Service
metadata:
  name: postgres
  labels:
    app: postgres
spec:
  type: NodePort
  ports:
  - port: 5432
  selector:
    app: postgres
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: sonar
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: sonar
    spec:
      containers:
      - name: sonar
        image: sonarqube:latest
        ports:
        - containerPort: 9000
        env:
        - name: SONARQUBE_JDBC_USERNAME
          value: sonar
        - name: SONARQUBE_JDBC_PASSWORD
          value: sonar
        - name: SONARQUBE_JDBC_URL
          value: jdbc:postgresql://postgres:5432/sonar
---
apiVersion: v1
kind: Service
metadata:
  name: sonar
spec:
  type: NodePort
  ports:
  - port: 9000
    nodePort: 30001
  selector:
    app: sonar

  

posted @ 2018-03-12 20:34  Bourbon.Tian  阅读(...)  评论(...编辑  收藏