1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| cat sonar-deploy.yaml apiVersion: v1 kind: ConfigMap metadata: name: sonar-config namespace: jenkins labels: app: sonar data: sonar.properties: | sonar.jdbc.url=jdbc:postgresql://postgres-sonar:5432/sonarDB sonar.jdbc.username=sonar sonar.jdbc.password=sonar --- apiVersion: apps/v1 kind: Deployment metadata: namespace: jenkins name: sonarqube labels: app: sonarqube spec: replicas: 1 selector: matchLabels: app: sonarqube template: metadata: labels: app: sonarqube spec: initContainers: - name: init-sysctl image: 192.168.129.33:5000/k8s/busybox imagePullPolicy: IfNotPresent command: ["sysctl", "-w", "vm.max_map_count=262144"] securityContext: privileged: true containers: - name: sonarqube image: 192.168.64.33:5000/jenkins/sonarqube:lts-community ports: - containerPort: 9000 #env: #- name: SONARQUBE_JDBC_USERNAME # value: "sonar" #- name: SONARQUBE_JDBC_PASSWORD # value: "sonar" #- name: SONARQUBE_JDBC_URL # value: "jdbc:postgresql://postgres-sonar:5432/sonarDB" #envFrom: #- configMapRef: # name: sonar-config livenessProbe: httpGet: path: /sessions/new port: 9000 initialDelaySeconds: 60 periodSeconds: 30 readinessProbe: httpGet: path: /sessions/new port: 9000 initialDelaySeconds: 60 periodSeconds: 30 failureThreshold: 6 resources: limits: cpu: 2000m memory: 2048Mi requests: cpu: 1000m memory: 1024Mi volumeMounts: - mountPath: /opt/sonarqube/conf name: config-volume - mountPath: /opt/sonarqube/data name: data subPath: data - mountPath: /opt/sonarqube/extensions name: data subPath: extensions volumes: - name: config-volume configMap: name: sonar-config - name: data persistentVolumeClaim: claimName: sonarqube-data
--- apiVersion: v1 kind: Service metadata: namespace: jenkins name: sonarqube labels: app: sonarqube spec: type: NodePort ports: - name: sonarqube port: 9000 targetPort: 9000 nodePort: 32107 protocol: TCP selector: app: sonarqube
|