Day 10/40 - Kubernetes Namespace Explained - CKA Full Course 2025

About this video

### Summary of the Video Content: 1. **Introduction and Context**: - The video is part of the "CKA 2024" series, focusing on Kubernetes namespaces. - The presenter, Push, emphasizes the importance of namespaces for resource isolation and management within a Kubernetes cluster. 2. **Purpose of Namespaces**: - Namespaces provide an additional layer of isolation within a Kubernetes cluster. - Resources created without specifying a namespace are placed in the `default` namespace. - Kubernetes creates some namespaces by default (e.g., `kube-system` for control plane components). - Namespaces help avoid accidental modifications or deletions of resources by separating them logically. 3. **Namespace Use Cases**: - Namespaces can be used to separate environments (e.g., test, production) for better security and access control. - Different permissions and roles can be assigned to each namespace. 4. **Resource Interaction Within and Across Namespaces**: - Pods within the same namespace can communicate using their hostnames. - Pods in different namespaces require a Fully Qualified Domain Name (FQDN) for communication (e.g., `..svc.cluster.local`). 5. **Hands-On Demonstration**: - The presenter demonstrates creating and managing namespaces (`demo` and `default`) using both imperative and declarative methods. - Commands like `kubectl create ns` (imperative) and YAML files (declarative) are used to create namespaces. - Deployments and pods are created in both namespaces to showcase connectivity tests. 6. **Service Exposure and Communication**: - Services are exposed in front of deployments to enable communication between namespaces. - Pods can communicate across namespaces using IP addresses but require FQDNs for hostname-based communication. - The `/etc/resolv.conf` file inside pods contains DNS resolution details, including the FQDN format. 7. **Key Observations**: - IP addresses are cluster-wide and accessible from any namespace. - Hostnames are namespace-specific and require FQDNs for cross-namespace communication. - Services and pods within the same namespace can communicate directly using hostnames. 8. **Commands and Tools Used**: - `kubectl get namespaces`: Lists all namespaces. - `kubectl create ns `: Creates a namespace imperatively. - `kubectl apply -f `: Creates resources declaratively using YAML. - `kubectl expose deployment`: Exposes a deployment as a service. - `kubectl exec -it -- sh`: Executes a shell inside a pod for testing connectivity. 9. **Connectivity Testing**: - Pods in different namespaces were tested for connectivity using `curl` and `ping`. - Cross-namespace communication was successful using FQDNs but failed with simple hostnames. 10. **Conclusion and Next Steps**: - Namespaces are crucial for isolating resources and managing access in Kubernetes. - The next video will cover multi-container pods and related concepts like arguments and commands. - Viewers are encouraged to like, comment, and subscribe to the channel for more content. ### Key Takeaways: - Namespaces enhance resource organization, security, and isolation in Kubernetes. - Cross-namespace communication requires FQDNs due to namespace-specific hostnames. - Hands-on practice with `kubectl` commands and YAML files is essential for mastering Kubernetes concepts.


Course: Certified Kubernetes Administrator Full Course For beginners | CKA 2025

This playlist contains the complete CKA series for beginners, based on the latest 2025 curriculum. It includes 40+ videos with hands-on demos, assignments, and exam-based scenarios. We will cover everything from the basics to the Advanced, including fundamental concepts such as Docker, containers, Docker storage and networking, DNS, etc.

View Full Course