Skip to content

Command Line

Kubectl

kubectl run hello-minicube
kubectl cluster-info
kubectl get nodes


Namespce

kubectl get pods
kubectl get pods --namespace=prod
kubectl get pods --namespace=dev

Switch Namespce

#change the default to dev
kubectl config set-context $(kubectl config current-context) --namespace=dev
kubectl get pods
kubectl get pods --namespace=default
kubectl get pods --namespace=prod
kubectl get pods --all-namespaces

Create pods with YAML

kind: Pod
metadata:
    name: myapp-pod
    labels:
        app: myapp
spec:
    containers:
        - name: nginx-container
          image: nginx
kubectl create pod -f xx.yaml