k8s Pods
- PODs
- smallest object in k8s, contains containers, can contain one or more containers
- scale service by creating more pod instances.
- additional container could be helper container.
- network space is shared between containers in the same pod, they can communicate on localhost.
- Static Pods
On standalone VM, the kubelet can be configured to
- read pod definitions from
(Option:--pod-manifest-path=/etc/kubernetes/manifests).
ps ax | grep kubeconfig
- kubeconfig.yaml staticPodPath: /etc/kubernetes/manifest.
- It also assures they stay alive.
- Only POD's , nothing else.
view with docker ps
- the kubeadm k8s setup uses static pods to run the k8s management software as pods on nodes.
- read pod definitions from
Static Pods and DaemonSets are ignored by the Kube-Scheduler
Pod, eq in Docker ENTRYPOINT->command & CMD->args
apiVersion: v1 kind: Pod metadata: name: ubuntu-sleeper-pod spec: containers: - name: ubuntu-sleeper image: ubuntu-sleeper command: ["sleep2.0"] args: ["10",] ... envFrom: - configMapRef: name: app-conf-map - secretRef: name: app-secret ... env: - name: APP_COLOR1 value: pink - name: App_COLOR2 valueFrom: configMapKeyRef: - name: App_PWD valueFrom: secretKeyRef: name: app-secret key: DB_Password ... volumes: - name: app-secret-volume secret: secretName: app-secret
- Multi-container pods
- Types
- Adapter
- Ambassador
- All containers are expected to stay alive in POD. If any fail, the POD restarts.
InitContainers: separate section in line with containers:
- Runs one at a time, before Containers: and must all complete before real container starts.
if an InitContainer fails, Pod restarts
- Runs one at a time, before Containers: and must all complete before real container starts.
- Types