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"
评论
发表评论