K8s Pods - philipf/notebook GitHub Wiki

Sample Pod YAML

apiVersion: v1
kind: Pod
metadata:
  name: my-pod
  labels:
    app: myapp
spec:
  containers:
  - name: myapp-container
    image: busybox
    command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']

Commands

kubectl create -f my-pod.yml
kubectl apply -f my-pod.yml
kubectl edit pod my-pod
kubectl delete pod my-pod

Namespaces

kubectl get namespaces
kubectl get pods -n default
kubectl create <namespace>
kubectl delete <namespace>

YAML definition:

See namespace section

metadata:
  name: my-pod
  namespace: my-namespace
  labels:
    app: myapp
⚠️ **GitHub.com Fallback** ⚠️