DEV Community

Girish Jaju
Girish Jaju

Posted on

2

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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay