我想使用声纳Qube并将其部署在AKS(Azure Kubernetes)上。我想将声纳日志,数据,conf和扩展名存储在持久卷上。但是,由于超时,AKS似乎无法安装卷。
我已经构建了一个脚本,该脚本创建了卷+服务+部署和入口。 ->没有成功
我试图将卷创建与应用程序创建和卷附加分离->没有成功
但是,卷已创建并在AZURE上可用
配置:
这是我用来创建卷的脚本:
#Namespace creation
apiVersion: v1
kind: Namespace
metadata:
name: cicd
labels:
name: cicd
---
#PVC for Sonar’s data directory creation
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sonar-data
namespace: cicd
spec:
accessModes:
- ReadWriteOnce
storageClassName: default
resources:
requests:
storage: 5G
---
#PVC for Sonar’s conf directory
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sonar-conf
namespace: cicd
spec:
accessModes:
- ReadWriteOnce
storageClassName: default
resources:
requests:
storage: 5Gi
---
#PVC for Sonar’s logs directory
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sonar-logs
namespace: cicd
spec:
accessModes:
- ReadWriteOnce
storageClassName: default
resources:
requests:
storage: 10Gi
---
#PVC for Sonar’s extensions directory
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sonar-extensions
namespace: cicd
spec:
accessModes:
- ReadWriteOnce
storageClassName: default
resources:
requests:
storage: 5Gi
---
#Create secretKeyRef
apiVersion: v1
kind: Secret
metadata:
name: sonar-secret
namespace: cicd
type: Opaque
data:
password: *****************
这是我用来创建声纳的脚本:
#SonarQube deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: sonarqube
name: sonarqube
namespace: cicd
spec:
replicas: 1
template:
metadata:
labels:
app: sonarqube
spec:
securityContext:
runAsUser: 0
fsGroup: 0
containers:
- name: sonarqube
image: sonarqube:latest
resources:
requests:
cpu: 500m
memory: 1024Mi
limits:
cpu: 2000m
memory: 2048Mi
volumeMounts:
- mountPath: "/opt/sonarqube/data/"
name: sonar-data
- mountPath: "/opt/sonarqube/extensions/"
name: sonar-extensions
- mountPath: "/opt/sonarqube/logs/"
name: sonar-logs
- mountPath: "/opt/sonarqube/conf/"
name: sonar-conf
env:
- name: "SONARQUBE_JDBC_USERNAME"
value: "sonar"
- name: "SONARQUBE_JDBC_URL"
value: "jdbc:sqlserver://internal-sql-az-westeurope.database.windows.net:1433;databaseName=Sonar;user=SONARQUBE_JDBC_USERNAME;password=SONAR_SQL_LOGIN_PASSWORD"
- name: "SONARQUBE_JDBC_PASSWORD"
valueFrom:
secretKeyRef:
name: sonar-secret
key: password
ports:
- containerPort: 9000
protocol: TCP
volumes:
- name: sonar-data
persistentVolumeClaim:
claimName: sonar-data
- name: sonar-extensions
persistentVolumeClaim:
claimName: sonar-extensions
- name: sonar-logs
persistentVolumeClaim:
claimName: sonar-logs
- name: sonar-conf
persistentVolumeClaim:
claimName: sonar-conf
---
# --------------
# Service Object
# --------------
apiVersion: v1
kind: Service
metadata:
labels:
name: sonarqube
name: sonarqube-service
namespace: cicd
spec:
ports:
- port: 80 # Default port for image
protocol: TCP
selector:
name: sonarqube
# -----------------
# Ingress object
# -----------------
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sonarqube-api-ingress
namespace: cicd
annotations:
kubernetes.io/ingress.class: nginx
#Default is 'true'
#nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$1
#https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#whitelist-source-range
nginx.ingress.kubernetes.io/whitelist-source-range: "******"
spec:
tls:
- hosts:
- sonar.traceparts.com
secretName: aks-ingress-tls-star-traceparts-com
rules:
- host: sonar.traceparts.com
http:
paths:
- backend:
serviceName: sonarqube-service
servicePort: 80
path: /(.*)
有人可以帮助我理解这个问题吗?