Pods Flashcards
What is a multi-container pod in Kubernetes?
A multi-container pod in Kubernetes is a pod that runs multiple containers that share the same network namespace and storage volumes.
What is the purpose of using multi-container pods?
Multi-container pods are used to group containers that work together closely within the same pod, enabling them to share data and resources.
Can containers within a multi-container pod communicate with each other using localhost?
Yes, containers within the same pod can communicate with each other using localhost, as they share the same network namespace.
What are some common use cases for multi-container pods?
Common use cases for multi-container pods include using a sidecar container for log collection, an adapter container for data transformation, or an ambassador container for accessing external services.
How can you define a multi-container pod in a YAML file?
In a YAML file, you define a multi-container pod by listing multiple containers under the containers section within the pod’s specification.
What command is used to create a multi-container pod from a YAML file?
The kubectl create -f command followed by the YAML file name is used to create a multi-container pod.
How can you access and interact with a specific container within a multi-container pod?
You can access and interact with a specific container within a multi-container pod using the kubectl exec -it command, specifying the pod name and container name.
What is the purpose of using multi-container pods over single-container pods?
Multi-container pods are used when containers need to work closely together and share resources within the same pod, keeping related functionalities grouped together.
What happens if one container in a multi-container pod fails?
If one container in a multi-container pod fails, Kubernetes may restart it automatically, ensuring that the desired state of the pod is maintained.
Can multi-container pods have containers with different base images?
Yes, multi-container pods can have containers with different base images, allowing for flexibility in choosing the appropriate tools or functionalities for each container.
What is the fundamental networking model in Kubernetes?
The fundamental networking model in Kubernetes is a flat network, where most resources within a cluster can communicate with each other.
How are IP addresses assigned to pods in Kubernetes?
Pods in Kubernetes are assigned ephemeral IP addresses, meaning these IP addresses may change if a pod is rescheduled.
Can containers within the same pod communicate with each other directly?
Yes, containers within the same pod can communicate with each other directly using localhost and different port numbers.
How do pods communicate with each other in Kubernetes?
Pods communicate with each other through services, which act as load balancers for network traffic within the cluster.
What is a load balancer service in Kubernetes used for?
A load balancer service in Kubernetes is used to route external network traffic to pods within the cluster, providing external access to services.
Can pods on different nodes communicate with each other directly?
Yes, pods on different nodes within a Kubernetes cluster can communicate with each other directly.
What is the purpose of labels and selectors in Kubernetes networking?
Labels and selectors are used to identify, describe, and group related sets of objects or resources, allowing for easy filtering and selection.
How do labels and selectors work together in Kubernetes?
Selectors use labels to filter or select objects. Objects with labels that match the selector’s criteria are selected.
What are some common use cases for services in Kubernetes networking?
Common use cases for services in Kubernetes networking include load balancing traffic to pods, providing a stable endpoint for pods, and enabling service discovery.
What is the difference between ephemeral IP addresses and persistent IPs in Kubernetes?
Ephemeral IP addresses are assigned to pods and may change if a pod is rescheduled, while persistent IPs are assigned to services and remain stable for external access.