Some trivia and background theory before starting: a) Hypervisor Virtualization (VM = atomic unit for scheduling) b) Docker (Container = atomic unit for scheduling) c) K8s (Pod = atomic unit of scheduling) Rules: - A Pod should contain 1 container, but can host more (supporting containers). - Each Pod has it's own IP address (managed by k8s ICN networking) - Each container inside a Pod must have different ports - Volumes and PID namespaces are shared between containers inside a Pod - Interpod Communication: All Pods can communicate within each other - Intrapod Communication: All containers inside a Pod can communicate via localhost on different port numbers - All containers in the Pod must start successfully, if not the Pod won't be added to the K8s cluster - Pods get scheduled on Nodes (minions) Docs: https://kubernetes.io/docs/concepts/workloads/pods/pod-overview/
Instructions
a) Declare a Pod in a Manifest File (pod.yml) b) Upload the Manifest File to apiserver {}
Lifecycle
apiserver{} > Pending (Failed) > Running (Failed) > Succeeded
Manifest Blueprint (*.yml)
apiVersion: v1
kind: Pod
metadata:
name: sampleapp-pod
labels:
app: sampleapp
env: production
spec:
containers:
- name: myapp-container
image: nginx
ports:
- containerPort: 8080
Commands
kubectl describe nodes
kubectl create -f pod-blueprint.yml
kubectl get pods
kubectl logs -f sampleapp-pod
kubectl describe pods
kubectl delete pod sampleapp-pod
kubectl get pods --all-namespaces
Created on 5/21/2018