install postgres
files: https://github.com/Song2017/cloud-app-examples/tree/main/k3s/ubuntu-22/postgres
postgres的账号密码
kubectl apply -f config.yml
声明持久化卷
kubectl apply -f pvc.yaml
创建持久化卷
kubectl apply -f pv.yml
创建postgres 实例,
kubectl apply -f pg_ss.yml
暴露端口到外网
kubectl apply -f svc.yml
connect
查找postgres的外网ip
kubectl get svc -n default
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.43.0.1 <none> 443/TCP 18h
service/postgres NodePort 10.43.111.132 <none> 5432:31070/TCP 128m
notes
- 如果是在云服务器上部署的, 外网访问需要放开安全组规则
评论列表,共 0 条评论
暂无评论