創建部署
cd test-ingress-nginx
kubectl apply -f mandatory.yaml
kubectl apply -f service-nodeport.yaml
gedit service-nodeport.yaml mandatory.yaml &
kubectl get deployment
kubectl get deployment -n ingress-nginx
kubectl get svc -n ingress-nginx
kubectl get pods -n ingress-nginx
創建 Ingress,代理到後端 nginx 服務
kubectl get deployment
kubectl delete deployment myweb
kubectl delete svc myweb
kubectl apply -f httpd.yaml
kubectl get deployment
gedit ingress-httpd.yaml
modifyserviceName
tohttpd
curl [httpd_CLUSTER-IP]
kubectl apply -f ingress-httpd.yaml
kubectl get pod -n ingress-nginx
kubectl get pod -n ingress-nginx -o wide
modifyC:\Windows\System32\drivers\etc
中的hosts
192.168.8.130 www.a.com
192.168.8.131 www.a.com
kubectl get pod -o wide
kubectl exec [vm3_httpdName] -it -- bash
echo "vm3 www.a.com" > hi.htm
kubectl exec [vm2_httpdName] -it -- bash
echo "vm2 www.a.com" > hi.htm
cp httpd.yaml httpd2.yaml
cp ingress-httpd.yaml ingress-httpd2.yaml
gedit httpd2.yaml ingress-httpd2.yaml
kubectl apply -f httpd2.yaml
kubectl apply -f ingress-httpd2.yaml
kubectl exec [http2_Name] -it -- bash
echo "www.b.com" > hi.htm
Deployment
kubectl get deployment
kubectl describe deployment httpd
kubectl get replicaset
kubectl get deployment httpd2
kubectl edit deployment httpd2
kubectl apply -f cronjob.yml
kubectl get pod -o wide