Header Ads

Header ADS

Deploy NGINX on the Kubernetes Cluster


Deploy NGINX on the Kubernetes Cluster

From your master node kubectl create an nginx deployment:
kubectl create deployment nginx --image=nginx




  1. This creates a deployment called nginxkubectl get deployments lists all available deployments:
    kubectl get deployments
    
  2. Use kubectl describe deployment nginx to view more information:





  1. 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 the 32000+ range.
    Try to get 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
    
  2. 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

Powered by Blogger.