在K8S中部署禪道zentao
阿新 • • 發佈:2020-09-18
目錄
官方文件中並沒有說明K8S下的部署,只在docker下部署,所以官方的映象不是通用的。直接從官方拉個映象放在K8S上並不能執行。本例中用的映象可能是原作者修改好的,直接拿來用就好了。
建立pv、pvc
apiVersion: v1 kind: PersistentVolume metadata: name: zentao spec: capacity: storage: 20Gi accessModes: - ReadWriteOnce persistentVolumeReclaimPolicy: Recycle storageClassName: nfs-zentao nfs: path: /data/zentao server: 10.61.150.16 --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: pvc-zentao namespace: servers spec: accessModes: - ReadWriteOnce resources: requests: storage: 20Gi storageClassName: nfs-zentao
建立dp
apiVersion: apps/v1 kind: Deployment metadata: name: zentao-server namespace: servers labels: app: zentao spec: selector: matchLabels: app: zentao replicas: 1 template: metadata: labels: app: zentao spec: containers: - name: zentao image: hub.ict.ac.cn/dev/zentao:12.3 imagePullPolicy: IfNotPresent env: - name: ADMINER_USER value: 'root' #mysql使用者名稱 - name: ADMINER_PASSWD value: '0ckrtsxmdfg_4z7uvR' #mysql密碼 - name: BIND_ADDRESS value: 'true' - name: SMTP_HOST value: 'smtp.test.cn' ports: - name: zentao containerPort: 80 - name: mysql containerPort: 3306 volumeMounts: - name: zentao-data mountPath: /opt/zbox volumes: - name: zentao-data persistentVolumeClaim: claimName: pvc-zentao
建立svr
apiVersion: v1 kind: Service metadata: labels: app: zentao name: zentao namespace: servers spec: ports: - name: zentao port: 80 protocol: TCP targetPort: 80 nodePort: 30051 - name: mysql port: 3306 protocol: TCP targetPort: 3306 nodePort: 30052 selector: app: zentao
測試
http://172.16.0.21:30051
admin 123456