Create Namespaces in Kubernetes Cluster
Create a namespace named dev and create a POD under it; name the pod dev-nginx-pod and use nginx image with latest tag only and remember to mention tag i.e nginx:latest.
Here are the steps to achieve the deployment based on the provided requirements using the kubectl utility:
1. To create a namespace named "dev", use the following command:
# kubectl create namespace dev
2. Next, create a YAML file (e.g., `dev-nginx-pod.yaml`) with the following content to define the POD:
apiVersion: v1
kind: Pod
metadata:
name: dev-nginx-pod
namespace: dev
spec:
containers:
- name: nginx-container
image: nginx:latest
3. Apply the YAML file to create the POD in the "dev" namespace:
# kubectl apply -f dev-nginx-pod.yaml
4. To verify that the POD has been created, you can use the following command:
# kubectl get pods -n dev
This will list the PODs in the "dev" namespace, including your `dev-nginx-pod`.
The provided steps will help you set up a namespace named "dev" and create a POD named "dev-nginx-pod" with the specified nginx image using the latest tag. Make sure to adjust any configuration details as needed for your environment.
No comments:
Post a Comment