Day 33 Task: Working with Namespaces and Services in Kubernetes

Day 33 Task: Working with Namespaces and Services in Kubernetes

Congrats🎊🎉 on updating your Deployment yesterday💥🙌

What are Namespaces and Services in k8s

In Kubernetes, Namespaces are used to create isolated environments for resources. Each Namespace is like a separate cluster within the same physical cluster. Services are used to expose your Pods and Deployments to the network. Read more about Namespace Here

Today's task:

Task 1:

  • Create a Namespace for your Deployment

    Docker, minikube and kubectl should be pre-installed in the instance. Make a directory by firing command “mkdir <directory_name>”.

  • Use the command kubectl create namespace <namespace-name> to create a Namespace

    kubectl create namespace react-django-app

  • Update the deployment.yml file to include the Namespace

  • Apply the updated deployment using the command: kubectl apply -f deployment.yml -n <namespace-name>

  • Verify that the Namespace has been created by checking the status of the Namespaces in your cluster.

    kuectl get namespace

  • Task 2:

  • Read about Services, Load Balancing, and Networking in Kubernetes.

    A service in a Kubernetes is a logical set of pods, which works together. With the help of services, users can easily manage load balancing configurations.

  • Load balancing is the process of efficiently distributing network traffic among multiple backend services, and is a critical strategy for maximizing scalability and availability. There are a variety of choices for load balancing Kubernetes external traffic to Pods, each with different tradeoffs.

  • Kubernetes networking is an integral part of managing and making communication easier within a Kubernetes cluster. It manages a wide range of operations, such as:

    • Handling internal container communication

    • Exposing the containers to the internet

Thank you for reading this blog. Hope it helps.

— Safia Khatoon

Happy Learning! :)