Create a simple deployment in the new namespace:
kubectl apply -f namespace.yaml
: Validates the command and displays the object that would be created without actually sending it to the API server. create namespace kubectl
kubectl apply -f - <<EOF apiVersion: v1 kind: Namespace metadata: name: my-app EOF
Example with dry-run:
This command creates a deployment named my-deployment using the nginx image in the my-namespace namespace.
kubectl get pods -n dev-environment kubectl apply -f my-app.yaml -n dev-environment Create a simple deployment in the new namespace:
To view detailed information about a specific namespace:
kubectl create namespace team-a kubectl create namespace team-b create namespace kubectl
In this review, we will walk through the process of creating a namespace in Kubernetes using the kubectl command-line tool.