k8s部署单节点postgres
给postgres服务器节点打标签
kubectl get node --show-labels=true
kubectl label nodes k8s-02 postgres-server=master
postgres服务器节点创建目录
mkdir -p /home/postgres/data/data
编辑部署文件postgres.yaml
apiVersion: v1
kind: Namespace
metadata:
name: k8s-postgres
---
apiVersion: v1
kind: Service
metadata:
labels:
app: postgres-master-out
name: postgres-master-out
namespace: k8s-postgres
spec:
type: NodePort
ports:
- port: 5432
targetPort: 5432