小编Ćep*_*epa的帖子

Kubernetes-封装DB的Pod崩溃

尝试将Django应用程序部署到Kubernetes集群时遇到问题。更具体地说,当我尝试部署PostgreSQL时。

这是我的.YML部署文件的样子:

apiVersion: v1
kind: Service
metadata:
  name: postgres-service
spec:
  selector:
    app: postgres-container
    tier: backend
  ports:
    - protocol: TCP
      port: 5432
      targetPort: 5432
  type: ClusterIP
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: postgres-pv
  labels:
      type: local
spec:
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 2Gi
  hostPath:
    path: /tmp/data/persistent-volume-1 #U okviru cvora n
  persistentVolumeReclaimPolicy: Retain
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: postgres-pv-claim
  labels:
    type: local
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: postgres
spec: …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform kubernetes google-kubernetes-engine

1
推荐指数
1
解决办法
912
查看次数