Showing posts with label Kubernetes. Show all posts
Showing posts with label Kubernetes. Show all posts

Thursday, 12 September 2019

Setting up Kubernetes API Access Using Service Account

Setting up Kubernetes API Access Using Service Account



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 nginx. kubectl 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.