K8s Notes

 
 
 

Every node must have installed

container and kublet (scheduled the process of container on nodes) kublet interacts with node and container  ….. kubelet start the pods with a container inside…..also kubelet scheduled the process like cpu mem on Pods.

 kubelet services– like LB catch the request and send to the respective pod

Kube proxy –  kube proxy help to forward the request in right manner so that it will help to minize the time of request .

How to you interact with the cluster

1 schedule the pods

2 monitor

3 re-schedule and restart the pod

4 join the new pod in cluster

All these are managing by master node

 Every master node have four services control the cluster and node

1 API server works as cluster gateway get the request from the cluster and work as a gatekeeper for access and authentication ( get some request à api server à validate the request and send request to other process the start the POD…… API server is the single entry point for the cluster

2.  Scheduler – if you have send the request for schedule a new POD …it will send the send the request to API server and the API server validate the reqest ans send it to the scheduler to schedule the new pod .. scheduler is interligent enough is where to put pod according to the resurce.

3. controller manager – detectes the cluser changes like pod crash and try to make the POD avaiablle asap. For that CM send the request to è schedulerè make the request to kublet to start the POD of available resource.

4. ETCD– Key value store for cluster states ….all the changes made in cluster saved into the ECTD …also ETCD has the data information for the cluster

We have multiple K8 master where API server work as load balancer and ETCD works are distribute data source for all the masters…. Master server need less reosurces and worker nod need more resources.

MINIKUBE and KUBECTL

Minikube- MK is one node cluster where master node and worker node services are running on one machine (local test cluster)…DOcker container is pre-installed on MK

KUBECTL- send the command to API server to make the changes

KUBECTL COMMANDS

Kubectl get node (status of nodes)

Kubectl get pod (status of pods)

Kubectlget services (status of service)

Kubectl create deployment (creat the deployment of PODS)

Kubectl get replicaset

Kubectl describe service name pod name or node name

Kubectl apply –f( file name) deployment file name

KUBERNETS YAML FIlE

  1. Meta data
  2. Specification

KUBERNETES NAMESPACE

NAMESPACE- we can orgnise resource in namespace we have multipul name space in cluster…. Basically NS is virtual cluster inside the cluster ….when we create cluster by default 4 NS created

  1. Kube-node-lease (contain the info of heartbeat of the nodes within the cluster)
  2. Kube-public (publicaly access data
  3. Kube-system (not for us ..it is for system processes)
  4. Kubenet dashbard (for minikube not for standard cluster)

Why we need NS

If all the services , component are in default NS it is difficult to manage them for simplely the managenet of services and component we create NS according to the service (like we can create DB pod or service in one NS with the name of DB and so on

K8s Ingresss

Ingress work as external service ….so that user can access the website by the domain name instead of IP and port ……we can create the ingress file that forwad the rewuest to internal service and interbal service send the request ot POD and then POD make the websites available,

HELM Package for K8

What is Helm—  it is the package manager for K8..it is YUM or APT for K8. Helm is a package of YML file and distrbiut them to private and public repositories

Helm chart structure

My chart

Chart.yml

Value.yml

Charts

Templates

Helm installation two part

Helm server it is also caller tiller

Helm client

KUBERNET VOLUMES explained   

How to persists data in K8 using volumes?

  1. Persisten volume
  2. Persisten volume claim
  3. Storage class

We need to storage which is not depend on POD lifecycle

Storage need to be available on pod so that new pod restarted it will get the data from storage

We need highly available storage it cluster crash our data is still safe and available

Persistent volumes is a cluster resource like RAM and CPU …it can be created by YML file …..also PV need straoge from local disk outside cluster or cloud storage ……available for whole cluster

STORAGE CLASS

SC provide PV dynamically when PVC need it or access it……each SC has there own provisoner which provide the PV to PVC…..SC highlisted the Storage provider

STORAGE Class Usage

pod claim storage via PVCà PVC requestr storage from SCà SC create PV that meets the PVC requirement

Statefull set application—-   all application that   storae data keep track of its state

STATELESS application—-don’t take record of its data

K8 Services.

Each pods has its own IP address but when Pods destroyed IP assosciate with the pod is gone and new IP assign to new pods

We need service for-

  1. Stable IP add
  2. For load balancing
  3. Communication within the and outside the POD

Type of services in K8

  1. ClusterIp service- default type
  • nodePort: The port on the node where external traffic will come in on
  • port: The port of this service
  • targetPort The target port on the pod(s) to forward traffic to
  • Headlesss service type –  we use this service in case of statefull appplicaion like we to talk to the DB in this we need to specific pod to talk for this we create headless service

We need to clusterip service to NONe in yml file

  • NODE PORT service:  node port service accessabile the application on static port
  • LOAD Balancer service: service become accessabile externally through cloud provider load balance

 

Check :  INSTALLATION & CONFIGURATION OF NODE EXPORTER

2 thoughts on “K8s Notes”

Leave a Reply

Your email address will not be published. Required fields are marked *