--- apiVersion: apps/v1 kind: StatefulSet metadata: name: sonarqube spec: replicas: 1 serviceName: sonarqube selector: matchLabels: app: sonarqube template: metadata: labels: app: sonarqube spec: containers: - name: sonarqube image: sonarqube:10.3-community env: - name: SONAR_JDBC_URL value: jdbc:postgresql://postgresql:5432/sonar - name: SONAR_JDBC_USERNAME value: sonar - name: SONAR_JDBC_PASSWORD value: sonar ports: - name: http containerPort: 9000 protocol: TCP resources: {} volumeMounts: - name: sonarqube-data mountPath: /opt/sonarqube/data - name: sonarqube-logs mountPath: /opt/sonarqube/logs - name: sonarqube-extensions mountPath: /opt/sonarqube/extensions volumes: - name: sonarqube-data hostPath: path: /data/sonarqube/sonarqube/data - name: sonarqube-logs hostPath: path: /data/sonarqube/sonarqube/logs - name: sonarqube-extensions hostPath: path: /data/sonarqube/sonarqube/extensions affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: "kubernetes.io/hostname" operator: In values: - bfs-k8snode-10-2-0-14.hetzner.base.beaconfireinc.com --- apiVersion: v1 kind: Service metadata: name: sonarqube spec: type: ClusterIP ports: - name: http protocol: TCP port: 9000 targetPort: http selector: app: sonarqube