DEV Community

Girish Jaju
Girish Jaju

Posted on

Create and expose deployment using NodePort Service in Kubernetes

This is a practice question for Kubernetes CKA and CKAD exams.

Question
We have a 3 node cluster setup locally using kubeadm. We need to do the following:

  • Create a deployment named web-deploy with the 3 replicas of image mycloudtutorials/poddeployservicedemo:latest in namespace app1
    (The Docker container is created from apache image, exposing the application on port 80)

  • Pass the following environment variables NODE_NAME, POD_NAME, POD_IP which are the name of the node where the pod is running, name of the pod and the ip address of the pod respectively

  • Verify the pods are working fine, by curl to the individual pods using POD’s internal ip address

  • Create a service for this deployment of type NodePort with name web-service in namespace app1 on port 30090

  • Check the End points

  • Access the service on each of the node:port of the cluster nodes from outside of the cluster

Answer
I have published a Youtube video for step by step solution for this question.
You can check at

#kubernetes

#devops

Content centering around the shifting left of responsibility, deconstruction of responsibility silos, and the automation of repetitive work tasks.

#cka

#ckad

Top comments (0)