K8S完整部署项目实战案例
生活随笔
收集整理的這篇文章主要介紹了
K8S完整部署项目实战案例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
構建NFS文件共享
主節點master配置
vim /etc/exports systemctl restart nfs.service systemctl restart rpcbind.service從節點配置
驗證一下:
部署并初始化數據庫
deploy
vim beiqin-db-deploy.yml kubectl create -f beiqin-db-deploy.yml
驗證庫表是否建好:
進入容器內部–
service
vim beiqin-db-service.yml kubectl create -f beiqin-db-service.yml #查看創建好的service服務 kubectl get service 或 kubectl get svc部署web應用
deploy
vim beiqin-app-deploy.yml kubectl create -f beiqin-app-deploy.yml
查看啟動日志:
curl一下,發現連接不上數據庫:
重新創建:
此時curl就沒有問題:
service
vim beiqin-app-service.yml kubectl create -f beiqin-app-service.yml配置端口轉發
vim /etc/rinetd.conf # 內容: 0.0.0.0 80 10.103.239.214 80
加載使之生效:
測試:
總覽:
總結
以上是生活随笔為你收集整理的K8S完整部署项目实战案例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: K8S资源限定(CPU、内存)及pod数
- 下一篇: zookeeper 分布式协调服务