CareerByteCode’s Substack

CareerByteCode’s Substack

Trainings

Class8 - Kubernetes 101: Mastering Namespaces, Pods, and Services for Efficient Cluster Management

We covered essential Kubernetes administration topics from managing namespaces to creating pods and load balancer services.

CareerByteCode's avatar
CareerByteCode
Apr 27, 2025
∙ Paid
Share

Today in Class 8, we covered essential Kubernetes administration topics from managing namespaces to creating pods and load balancer services. Here's a detailed breakdown of the hands-on tasks we worked on! 👇


1. Managing Namespaces in Kubernetes

We explored the importance of Namespaces in Kubernetes and learned how to create, view, and delete namespaces. These are useful for organizing resources within your cluster.

Key Steps:

  • To get the list of available namespaces:

kubectl get ns
  • To view details in the default namespace:

kubectl get all -n default
  • Creating a new namespace:

kubectl create ns azure
  • To delete a namespace:

kubectl delete -f <namespace_yaml_file>

2. Creating and Managing Pods Using YAML

Single Pod Creation

We created a single pod using a YAML file and ran an Nginx container inside it.

kubectl apply -f https://raw.githubusercontent.com/careerbytecode/cloud-devops-engineer-training/main/5-kubernetes_admin/1-namespace-Pod/pod/1-singlepod.yml
  • To view the created pod's details:

kubectl get all -n twitter

Multiple Pod Creation

We created multiple pods in the Facebook namespace, and learned how to access them.

kubectl apply -f https://raw.githubusercontent.com/careerbytecode/cloud-devops-engineer-training/main/5-kubernetes_admin/1-namespace-Pod/pod/2-multipods.yml
  • View all resources in the Facebook namespace:

kubectl get all -n facebook

3. Pod with Multiple Containers

We encountered an error while trying to create a pod with two containers using the same port. Kubernetes won’t allow this because multiple containers in a pod can’t share the same port.

Steps to see the error:

  • Deploy the pod with two containers using the YAML file:

kubectl apply -f https://raw.githubusercontent.com/careerbytecode/cloud-devops-engineer-training/main/5-kubernetes_admin/1-namespace-Pod/pod/2.1-duplicate-port-multipod.yaml
  • To view the issue:

kubectl describe pod/multicontainer-pods -n facebook

4. Deleting Resources

Delete a Pod or Namespace:

We also covered how to delete a pod and an entire namespace along with all its resources.

  • To delete a namespace and its resources:

kubectl delete ns facebook twitter azure

5. Load Balancer Service Creation

We created load balancing services in the Facebook and Twitter namespaces, which helps distribute traffic to multiple pods.

Key Steps:

  • To create a load balancing service:

kubectl apply -f https://raw.githubusercontent.com/careerbytecode/cloud-devops-engineer-training/main/5-kubernetes_admin/2-service/service/loadbalancer-facebook.yaml
  • Access the public IP from the service output and paste it into your browser to verify the service is working.

  • To delete the load balancer service:

kubectl delete -f https://raw.githubusercontent.com/careerbytecode/cloud-devops-engineer-training/main/5-kubernetes_admin/2-service/service/loadbalancer-facebook.yaml

What's Next?

In future classes, we'll dive deeper into Kubernetes Networking, StatefulSets, Helm, and advanced Kubernetes management techniques! 🌟


💡 Watch Class 8 Recording now and get hands-on with Kubernetes Administration!

Session 1

This post is for subscribers in the RealTime Expert Support plan

Already in the RealTime Expert Support plan? Sign in
© 2025 CareerByteCode
Publisher Privacy
Substack
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture