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 deployments
lists all available deployments:kubectl get deployments
- Use
kubectl describe deployment nginx
to view more information:
- Make the NGINX container accessible via the internet:
kubectl create service nodeport nginx --tcp=80:80
This 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 toget
the 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
curl
on the slave node:root@kube-master:~# curl kube-worker-1:32555
The output will show the unrendered “Welcome to nginx!” page HTML.
No comments:
Post a Comment