K8S中部署nginx 开始研究起来!

 







nano nginx-deployment.yaml



转换工具

curl -L https://github.com/kubernetes/kompose/releases/download/v1.32.0/kompose-linux-amd64 -o kompose

chmod +x kompose

mv ./kompose /usr/local/bin/kompose





下载docker-compose配置

wget -O ~/docker-compose.yml https://raw.githubusercontent.com/kejilion/docker/main/LNMP-docker-compose-11.yml


转换

kompose convert -f docker-compose.yml


部署

kubectl apply -f nginx-deployment.yaml

kubectl apply -f nginx-service.yaml



查看

kubectl get pods -A -o wide

kubectl get services

kubectl get services nginx


下载ingress

latest_version=$(curl -s https://api.github.com/repos/kubernetes/ingress-nginx/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')


kubectl delete -f "https://raw.githubusercontent.com/kubernetes/ingress-nginx/${latest_version}/deploy/static/provider/cloud/deploy.yaml"




































评论

此博客中的热门博文

科技lion官方一键脚本上线!VPS监控测试建站维护于一身的全能工具箱

CloudCone付费VPS分享 挺便宜的

新机到手我必做的10件事?让VPS飞速运行更安全!