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.
TASK 1
Create a Namespace for your Deployment
Use the below command to create a Namespace
kubectl create namespace <namespace-name>
Create a . yml file
The namespace in which the resources should be generated or changed is specified using the -n flag.
kubectl apply -f namespace.yml -n <namespace-name>
Check the status of the namespaces in your cluster to confirm that the namespace has been created.
Verify that the Namespace has been created by checking the status of the Namespaces in your cluster.
kubectl get namespaces
Task 2:
Read about services, load balancing, and networking in Kubernetes.
Service: A set of pods and the access policies for them are defined by a Kubernetes service, which is an abstraction layer. Services can load balance traffic between pods and give a consistent IP address and DNS name. This allows for inter-pod communication and separates the client from the backend pods.
Load balancing: The built-in load balancer service provided by Kubernetes enables you to split incoming traffic among many pods in a cluster. This enhances the scalability and dependability of your applications.
Networking: In Kubernetes, networking is in charge of establishing connections between pods and between the cluster and external networks. Routing, IP address management, and network policy enforcement are all included in this. Plugins that are integrated with the underlying network infrastructure are used to implement networking in Kubernetes.
Happy Learning!