scaling and management of containerized applications. • Places containers on nodes. • Recovers from failures. • Provides monitoring, logging, health checking etc. • Enables containers to fi nd each other.
cluster. • Node: Runs the applications. • Objects: Represent the state of the cluster. • Spec: Describes its desired state. • State: Describes the actual state. • Name: Unique for a kind in a namespace. • Namespaces: Provides a scope for names. • Labels: Key-value pairs attached to objects. • Label Selctor: Core grouping primitives. • Annotations: Attaching non-identifying metadata to objects.
container (Pod, ReplicationController, Deployment) • Discovery & Load Balancing: Joins workloads together into an externally accessible, load-balanced service (Service, Ingress) • Con fi g & Storage: Inject initialization and persist data externally (Volume, Secret) • Metadata: Con fi gure behavior of other resources within a cluster (LimitRange) • Cluster: Responsible for de fi ning the con fi guration of the cluster itself (Namespace, Binding)
Plane. • API Server: Front-end for the K8 control plane. • etcd: Distributed key-value store. • Controller-manager: Daemon that handles routine tasks • Node/Replication/Endpoint/Service Account/Token • Scheduler: Assignes pods to the worker node.
for pods that have assigned to its node. • Mounts the pod’s require volume. • Downloads the pod’s secrets. • Periodically runs the liveness probes. • Reports the status of the pod. • Reports the status of the node. • kube-proxy: Maintains network rules on the host and performs connection forwarding. • Container Engine: Use to run containers. Usually docker, but other’s possible thro’ Container Runtime Interface.
more application containers. • Storage resources. • Unique IP address. • Options on how container(s) should run. • Scheduled on a node and remains there until terminated or evicted. • Don’t self-heal by itself.
• Probes are performed by kublet on a container using a handler • Probe Types: readinessProbe, livenessProbe • Handler Types: ExecAction, TCPSocketAction, HTTPGetAction • Probe Result: success, failure, unknown • Restart policy based on livenessProbe: Always, OnFailure, Never
Creates ReplicaSet, which creates Pods. • Updating the deployment creates new ReplicaSet and revision. • During update, pods for the initial RS are scaled down, while pods from the new RS are scaled up. • Rollback to an earlier revision, will update the revision. • Current command can be recorded in the annotation of the resources. • Deployment strategy • Rolling update • Recreate
a speci fi ed number of them successfully terminate. • Reliably run a Pod to completion the speci fi ed number of times. • Run multiple Pods in parallel. • If Pods fail, the Job will create new Pods forever. • CronJobs create jobs once or repeatedly at speci fi ed times. • Concurrency policy can be con fi gured.
a pod. • When nodes are added to the cluster, pods are added to them. • When nodes are removed from the cluster, those pods are garbage collected. • Node selection: nodeSelector, a ffi nity • Deleting a DaemonSet will delete the pods. • Update strategy. • OnDelete • RollingUpdate
Pods and Policy by which to access them. • Maps an incoming port to a target port. • Endpoint: Pods targeted by the selector. • Service discovery • Environment variables: Services should be de fi ned fi rst • DNS: No ordering is required
internal IP. Only reachable from within the cluster - Default • NodePort: Exposes the service on each Node’s IP at a static port. Accesible from outside using NodeIP:NodePort • LoadBalancer: Exposes the service externally using a Cloud Providers’ load balancer. • ExernalName: Maps the service to the contents of the externalName fi eld, by returning the CNAME.
directory which is accessible to the containers in a pod. • Type of the volume determines the backend. • Pod de fi nition speci fi es which volumes are mounted at which path. • Each container can independently mount a volume.
crashes) • hostPath: Mounts a directory from host into the pod. • gcePersistentDisk: Mounts GCE Persistent Disk into the Pod. • awsElasticBlockStore: Mounts AWS EBS into the pod. • nfs: Mounts existing NFS into the POD. • secret • PersistentVolumeClaim
of the pod. • HostPath, NFS, etc • PersistentVolumeClaim(PVC): Request for storage by a pod. • Size, Access Mode, Storage Class • Storage Class • QoS levels, backup policies • Allows dynamic provisioning using provisioner and parameter fi elds
information in pod de fi nition or docker images. • Can be used as fi les in a volume, or injected by the kubelet. • Can be loaded as environment variable o • kubectl create secret generic test-app —from- literal=password=FOOPASS