0% found this document useful (0 votes)
28 views8 pages

K8 Notes

Uploaded by

electronics1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

K8 Notes

Uploaded by

electronics1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Architecture

Control Plane Components:

 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:

Pending Waiting to be scheduled, downloading images


Running Bound to a node, container is created
Succeeded Containers terminated, cannot be restarted
Failed Container terminated in failure by system
Unknown Status of pod is unknown

Name of pods must be in small letters

Commands

kubectl create –f filename Creates pod


kubectl get pods –o wide Details of created pod
kubectl describe pod podName Details of pod
kubectl apply -f filename Edit a running pod
kubectl logs podName check logs of running container in a pod
kubectl exec -it podName execute some commands in running container
/bin/bash
kubectl get pod podName -o Check manifest file of any pod
yaml
kubectl delete pod podName delete specific pod
kubectl delete -f filename delete all pods given in manifest file
kubectl edit pod podName Edit pod manifest file
kubectl run --image= Create a pod through command line
kubectl get rs get the current ReplicaSets deployed
kubectl get po -o wide --show- display the labels
labels

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 & Selectors:

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`

 For any help with manifest: kubectl explain object.field

A Deployment's rollout is triggered if and only if the Deployment's Pod template


(that is, .spec.template) is changed

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:

- Within a pod, will share same host networking


- Will have same IP but different port
- So containers communicate on different port

Pod to Pod:

 Each pod will get its own IP from host network


 Intra-node: between pods running on single worker node
o They will have communication by default as they share the host
 Inter-node: between pods running on different worker nodes
o Through route table and bridge network

Pod to service:

6
Services:

7
8

You might also like