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 in
deployment.yaml
and Update the deployment.yml file to include the Namespace
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo-app
namespace: django-app
labels:
app: todo-app
spec:
replicas: 3
selector:
matchLabels:
app: todo-app
template:
metadata:
labels:
app: todo-app
spec:
containers:
- name: todo-app
image: nsparthu/django-todo:latest
ports:
- containerPort: 8000
- Use this command to create a Namespace
kubectl create namespace <namespace-name>
- Apply the updated deployment using the command
kubectl apply -f deployment.yaml -n <namespace-name>
- Verify that the Namespace has been created by checking the status of the Namespaces in your cluster.
kubectl get namespace
- Need help with Namespaces? Check out this video for assistance.
Task 2:
- Read about Services, Load Balancing, and Networking in Kubernetes. Refer to official documentation of Kubernetes Link
Keep growing your Kubernetes knowledge💥🙌
Happy Learning
Thanks For Reading! :)
-Sriparthu💝💥