K8 Notes
K8 Notes
Kube-apiserver:
- Exposes kubernetes api
- Handle authentication, authorization, request validation
Etcd:
- Key-value store
- Stores objects and config information
Kube-scheduler:
- Monitor for newly created pods with no assigned role
- Allocate node to newly created pods
Kube-control-manager:
- Daemon which manages all components
Node Components:
Kubelet:
- Agent which makes sure containers are running on pod
- Ensures containers are healthy and as per PodSpec
Kube-proxy:
- Network proxy running on each node
- Implements service
- Takes care of networking in pods
1
POD
A Pod is a group of one or more containers, with shared storage and network
resources, and a specification for how to run the containers
A Pod is not a process, but an environment for running container(s). A Pod
persists until it is deleted
POD Lifecycle:
Commands
2
kubectl get deploy deployment -o check manifest file of deployment
yaml > deploy_sample.yaml
kubectl rollout status Get the current status of deployment
deployment/<deploymentName>
kubectl rollout history Revisions of deployment
deployment/nginx-deployment
kubectl rollout history See details of revision
deployment/nginx-deployment
--revision=2
kubectl rollout undo Roll back to previous version
deployment/nginx-deployment
--to-revision=2
kubectl scale Scale deployment
deployment/nginx-deployment
--replicas=10
Labels are nothing more than custom key-value pairs that are attached to objects and are used
to describe and manage different Kubernetes resources. We can add multiple Labels to
Kubernetes objects. Labels are always added under the “metadata” section of the manifest
With labels, Kubernetes is able to glue resources together when one resource needs to relate or
manage another resource.
Selectors are used by the users to select a set of objects. The label selector is the
core grouping primitive in Kubernetes. `matchExpressions` and `matchLabels`
Cheat-sheet:
Deployment manifest = Deployment + Replica set + Pod
Replica set = Replica set + Pod
3
4
Port TargetPort NodePort
Exposes the Kubernetes Port on which the service exposes a service
service on the specified will send requests to, that externally to the cluster
port within the cluster. your pod will be listening by means of the target
Other pods within the on. Your application in the nodes IP address and the
cluster can communicate container will need to be NodePort. NodePort is the
with this server on the listening on this port also. default setting if the port
specified port field is not specified.
5
Container to container:
Pod to Pod:
Pod to service:
6
Services:
7
8