Chapter 5. Pods Flashcards
What is a Pod ?
A Pod represents a collection of application containers and volumes running in the same execution environment. Pods, not containers, are the smallest deployable artifact in a Kubernetes cluster. This means all of the containers in a Pod always land on the same machine.
What Do Pods share ?
- Share the same IP
- Share the same port space ( network namespace )
- Have the same hostname ( UTS namespace )
- can communicate using native interprocess communication channels over System V IPC or POSIX message queues (IPC namespace)
Applications in different Pods are isolated from each other
What is the right question to ask yourself when designing Pods ?
Will these containers work correctly if they land on different machines?” If the answer is “no,” a Pod is the correct grouping for the containers. If the answer is “yes,” multiple Pods is probably the correct solution.
What is a pod manifest ?
Pods are described in a Pod manifest. The Pod manifest is just a text-file representation of the Kubernetes API object. Kubernetes strongly believes in declarative configuration.
Command to create a Pod:
kubectl run kuard –generator=run-pod/v1 \
–image=gcr.io/kuar-demo/kuard-amd64:blue
Command to delete a Pod:
kubectl delete pods/kuard
Command to access your pod:
kubectl port-forward kuard 8080:8080
Command to access your log:
kubectl logs kuard
kubectl -f logs kuard
Command to access your log from your previous instance of the container:
kubectl logs kuard –previous
Command to get an interactive session:
kubectl exec -it kuard ash
Command to execute command in the context of the container itself:
kubectl exec kuard date
Copy files to and from Containers
kubectl cp :/captures/capture3.txt ./capture3.txt
Copy files From and To Containers:
kubectl cp $HOME/config.txt :/config.txt
What methods we can use to check application health ?
- Liveness Probe
- Readiness Probe
- tcpSocket health checks
- exec probes
Which metrics Kubernetes allows to specify ?
- Resource requests specify the minimum amount of a resource required to run the application.
- Resource limits specify the maximum amount of a resource that an application can consume.