L8 - Platform as a Service (PaaS) - Kubernetes 2/2 Flashcards
What are web containers supported by?
A helper container that pulls the latest content.
How do pods create the environment for containers?
- unique IP address, shared memory etcs.
- containers inside a Pod use ports on the Pods’ localhost interface
How do pods have their own network namespace
Single IP address, single range of TCP ports and a routing table
How does external access to a container in a Pod take place?
- Pod IP address combined with the port of the container
How does container-to-container communication in a Pod work?
localhost adapter and port number
4 characteristics of pods
- Units of scheduling (scaling through adding or removing pods)
- Atomic units (starting or stopping pods will start and stop all containers)
- Mortal (a replacement Pod will have a new ID and IP and might run on another node)
- Managed by higher-level controllers (deployment, daemonSet, StatefulSet)
What does daemonSet do?
Ensures a Pod is running on each node
What does StatefulSet do?
StatefulSet is a Kubernetes object that manages a set of replicated pods, ensuring that each pod has a unique, persistent network identity and that the pods are deployed in a predictable order. StatefulSets are used for applications that require stable, unique network identities and persistent storage, such as databases, message brokers, and caches.
Adds guarantees and ordering and uniqueness of Pods
What is a Pod Network?
- for Pod-to-Pod communication
- K8s sets up bridge networks and routing tables such that Pods can reach other Pods via their IP address
What are examples of Pod Networks?
AWS VPC Container Network Interface (CNI), Calico
How are a Pod’s resources limited?
Through cgroups.
What do cgroups do?
- specify the resource limits for CPU, RAM, IOPS
What are the resource limits of Pods?
The aggregated limits of the containers plus possibly some Pod overhead
How is a pod created?
- Define a Pod in a manifest
- POST manifest to API server
- Schedule a Pod on a cluster
4 characteristics of Pod deployment
- Self-healing: failed Pods are replaced
- Scaling: # of replicas in ReplicaSet can be adapted as required & current state is adapted to match desired one
- Rolling update
- Versioned rolling update
How does a rolling update take place?
- POST a new version of the deployment YAML file with a new version of a container image
- K8s creates a new ReplicaSet
- When a new Pod is created in the ReplicaSet then an old Pod from the previous ReplicaSet is deleted –> zero downtime
What is a versioned rolling update?
- The old ReplicaSet still exists with the old configuration
- Rolling back simply winds up the old ReplicaSet
What do “Services” do for Pods?
- provide a reliable networking for a set of Pods
- stable DNS name, IP address and port
- service discovery through K8s DNS service
- LB across Pods
- Pods are connected to a service via labels and selector
What does the Endpoints object in a service do?
It is a dynamic list of Pods that match the label selector and balances requests over the Pods in the Endpoints.
4 types of Services
- ClusterIP Service
- NodePort Service
- LB Service
- ExternalName Service
What does the clusterIP Service do?
- IP address and port are only accessible inside of the cluster
A ClusterIP Service in Kubernetes is a type of service that exposes a set of pods to other parts of the cluster. A ClusterIP service provides a stable IP address and ports that are accessible only within the cluster.
What does the NodePort Service do?
- service has an additional port called the NodePort
- can be reached by sending a request to the IP address of any cluster node on the NodePort
- kube-proxy listens to that port and replaces target by the cluster IP of the service and its port. Then it is a cluster local request
The NodePort Service in Kubernetes is a type of service that exposes a application running on a cluster to external network traffic by assigning a static port on each node of the cluster. The traffic to this static port is then forwarded to the corresponding pod serving the application. NodePort is the simplest and most primitive way of exposing a service, it is useful for testing or simple use cases where load balancing is not needed.
LB Service
- extension of NodePort Service
- allows clients to reach Pods via LBs
ExternalName Service
- allows to route traffic to systems outside of your K8s cluster
- the service is implemented outside of the cluster and accessible through a domain name which is specified in the service YAML