Deploy NGINX on the Kubernetes Cluster
From your master node
kubectl create an nginx deployment:kubectl create deployment nginx --image=nginx
- This creates a deployment called
nginx.kubectl get deploymentslists all available deployments:kubectl get deployments - Use
kubectl describe deployment nginxto view more information:
- Make the NGINX container accessible via the internet:
kubectl create service nodeport nginx --tcp=80:80This creates a public facing service on the host for the NGINX deployment. Because this is a nodeport deployment, kubernetes will assign this service a port on the host machine in the32000+ range.Try togetthe current services:root@kube-master:~# kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5h nginx NodePort 10.98.24.29 <none> 80:32555/TCP 52s - Verify that the NGINX deployment is successful by using
curlon the slave node:root@kube-master:~# curl kube-worker-1:32555The output will show the unrendered “Welcome to nginx!” page HTML.



No comments:
Post a Comment