Kubernetes – Oct -2025

DevOps

MOTOSHARE ๐Ÿš—๐Ÿ๏ธ
Turning Idle Vehicles into Shared Rides & Earnings

From Idle to Income. From Parked to Purpose.
Earn by Sharing, Ride by Renting.
Where Owners Earn, Riders Move.
Owners Earn. Riders Move. Motoshare Connects.

With Motoshare, every parked vehicle finds a purpose. Owners earn. Renters ride.
๐Ÿš€ Everyone wins.

Start Your Journey with Motoshare

KEY – https://github.com/devopsschool-training-notes/Master-in-Devops-Engineering-MDE/tree/master/key

User name – ubuntu


Lab details

Day1

Workstation
------------------------
- kubectl
	~/.kube/config
	contains
		context1
			api-server
			user
			cert
		context2
			api-server
			user
			cert

Master
-----------------------
- Api Server 	- POD -> Container - Image -> GoogleReg
- etcd		 - POD -> Container - Image -> GoogleReg
- controller mgr - POD -> Container - Image -> GoogleReg
- Schedular	 - POD -> Container - Image -> GoogleReg

Kubelet + ContainerD + Docker + kubectl - kubeadm
kubeadm init

Worker
---------------------
Kube Proxy - POD -> Container - Image -> GoogleReg 
Kubelet + ContainerD + Docker + kubectl - kubeadm
kubeadm join 


Master - 65.0.133.20
Worker - 65.0.129.230

ubuntu

https://www.devopsschool.com/blog/kubernetes-installation-configuration/
<blockquote class="wp-embedded-content" data-secret="ggO9sVtHVx"><a href="https://www.devopsschool.com/blog/kubernetes-1-23-6-cluster-setup-master-and-worker-in-ubuntu-20-04/">Kubernetes 1.23.6 Cluster Setup Master and Worker in Ubuntu 20.04</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="position: absolute; visibility: hidden;" title="โ€œKubernetes 1.23.6 Cluster Setup Master and Worker in Ubuntu 20.04โ€ โ€” DevOpsSchool.com" src="https://www.devopsschool.com/blog/kubernetes-1-23-6-cluster-setup-master-and-worker-in-ubuntu-20-04/embed/#?secret=dT2HKiew4C#?secret=ggO9sVtHVx" data-secret="ggO9sVtHVx" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>


Code language: JavaScript (javascript)

- <a href="https://www.devopsschool.com/blog/kubernetes-1-23-6-cluster-setup-master-and-worker-in-ubuntu-20-04">https://www.devopsschool.com/blog/kubernetes-1-23-6-cluster-setup-master-and-worker-in-ubuntu-20-04</a>

API
	DEV			USER
	create			put - post - delete - get	
	read
	update
	delete
	

	create
		cmd
			create
		yaml
			create -f yaml
	read
		cmd
			get
			
		yaml
			get -f yaml
	update
		cmd
			edit
			

		yaml
			apply -f yaml
	delete
		cmd
			delete
		yaml
			delete -f yaml


apiVersion: v1
kind: Namespace
metadata:
  name: devops1
  labels:
    kubernetes.io/metadata.name: devops1


  26  kubectl
   27  clear
   28  kubectl cluster-info
   29  kubectl get nodes
   30  kubectl version
   31  kubectl get pods --all-namespaces
   32  clear
   33  kubectl get nodes
   34  kubeadm token create --print-join-command --ttl 0
   35  kubectl get nodes
   36  kubectl get nodes -w
   37  kubectl get nodes
   38  kubectl describe node ip-172-31-34-35
   39  clear
   40  kubectl taint nodes --all node-role.kubernetes.io/master-
   41  kubectl get nodes
   42  kubectl taint nodes ip-172-31-39-190 node-role.kubernetes.io/control-plane=:NoSchedule
   43  kubectl taint nodes ip-172-31-39-190 node-role.kubernetes.io/control-plane=:NoSchedule --overwrite
   44  kubectl get nodes
   45  clear
   46  ls
   47  kubectl
   48  kubectl api-resources
   49  clear
   50  kubectl get ns
   51  kubectl api-resources
   52  clear
   53  kubectl
   54  clear
   55  kubectl create rajesh
   56  kubectl create ns rajesh
   57  kubectl create ns dev
   58  kubectl get bs
   59  kubectl get ns
   60  kubectl describe ns rajesh
   61  kubectl edit ns rajesh
   62  kubectl describe ns rajesh
   63  kubectl delete ns rajesh
   64  kubectl get ns
   65  history
   66  clear
   67  ls
   68  vi ns.yaml
   69  kubectl create -f ns.yaml
   70  kubectl get -f ns.yaml
   71  kubectl describe -f ns.yaml
   72  vi ns.yaml
   73  kubectlapply -f ns.yaml
   74  kubectl apply -f ns.yaml
   75  kubectl describe -f ns.yaml
   76  kubectl delete -f ns.yaml



Code language: JavaScript (javascript)

POD

apiVersion: v1
kind: Pod
metadata:
  name: rajesh
  labels:
    app: helloworld
spec:
  containers:
  - name: devopsschool1
    image: scmgalaxy/nginx-devopsschoolv1
    ports:
    - name: nginx-port
      containerPort: 80

  41  clear
   42  vi pod.yaml
   43  kubectl create -f pod.yaml
   44  kubectl get pods
   45  kubectl get ns
   46  kubectl create -f pod.yaml
   47  kubectl create -f pod.yaml -n=dev
   48  kubectl get pods
   49  kubectl get pods -n=dev
   50  kubectl describe pod rajesh
   51  clear
   52  ls
   53  vi pod.yaml
   54  kubectl apply -f pod.yaml
   55  kubectl describe pod rajesh
   56  clear
   57  kubectl delete -f pod.yaml
   58  kubectl get pods
   59  history
Code language: JavaScript (javascript)

Day 2

container
--------------
docker exec -it contd /bin/bash
docker attach
docker logs
docker cp

Troubleshooting and Debugging Commands:
  describe        Show details of a specific resource or group of resources
  logs            Print the logs for a container in a pod
  attach          Attach to a running container
  exec            Execute a command in a container
  port-forward    Forward one or more local ports to a pod
  cp              Copy files and directories to and from containers
  auth            Inspect authorization
  events          List events

kubectl port-forward --address 0.0.0.0 pod/rajesh 8888:80


  106  kubectl get pods
  107  ls
  108  cd
  109  ls
  110  kubectl apply -f pod.yaml
  111  kubectl get pods
  112  kubectl logs rajesh
  113  kubectl describe pod rajesh
  114  clear
  115  curl http://192.168.1.4
  116  kubectl logs rajesh
  117  kubectl logs -h
  118  clear
  119  ls
  120  ps -eaf
  121  clear
  122  docker attach rajesh
  123  kubectl attach rajesh
  124  kubectl exec rajesh ls
  125  kubectl exec rajesh ps
  126  clear
  127  kubectl exec rajesh free
  128  kubectl exec rajesh ls
  129  kubectl exec -it rajesh /bin/bash
  130  clear
  131  ls
  132  kubectl
  133  clear
  134  kubectl port-forward -h
  135  clear
  136  kubectl port-forward --address 0.0.0.0 pod/rajesh 8888:80
  137  cledar
  138  clear
  139  kubectl get pods
  140  ls
  141  kubectl exec rajesh ls /opt
  142  kubectl cp pod.yaml rajesh:/opt
  143  kubectl exec rajesh ls /opt
  144  kubectl auth
  145  kubectl auth can-i create pod
  146  kubectl auth can-i create service
  147  kubectl auth can-i delete pod
  148  kubectl events
  149  kubectl events -h

Code language: JavaScript (javascript)

ReplicationController

apiVersion: v1
kind: ReplicationController
metadata:
  name: rajrc
spec:
  replicas: 5
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: scmgalaxy/nginx-devopsschoolv1



kubectl scale --replicas=1 rc/rajrc


  162  vi rc.yaml
  163  kubectl get rc
  164  kubectl apply -f rc.yaml
  165  kubectl get rc
  166  kubectl get pods
  167  kubectl describe rc rajrc
  168  clear
  169  kubectl edit rc rajrc
  170  kubectl get pods
  171  vi rc.yaml
  172  kubectl apply -f rc.yaml
  173  kubectl get pods
  174  kubectl
  175  clear
  176  kubectl scale -h
  177  clear
  178  kubectl scale --replicas=1 rc/rajrc
  179  kubectl get pods
  180  kubectl scale --replicas=20 rc/rajrc
  181  kubectl get pods
  182  kubectl scale --replicas=2 rc/rajrc
  183  kubectl get pods
  184  clear
  185  kubectl scale --replicas=1 rc/rajrc
  186  kubectl scale --replicas=10 rc/rajrc
  187  kubectl get pods
  188  kubectl delete pod rajrc-2gpfj rajrc-5pkzb rajrc-7z248
  189  kubectl get pods
  190  kubectl get rc
  191  kubectl delete rc rajrc
  192  kubectl get pods
Code language: JavaScript (javascript)

ReplicaSets == ReplicationController

Kubernetes Desployment

Service

  224  kubectl apply -f pod1.yaml
  225  kubectl apply -f pod2.yaml
  226  kubectl get pods -o wide --show-labels
  227  curl http://192.168.1.121
  228  curl http://192.168.1.122
  229  clear
  230  ls
  231  kubectl create service
  232  kubectl create service clusterip -h
  233  clear
  234  kubectl create service clusterip svc1 --tcp=5678:80
  235  kubectl get svc
  236  kubectl describe svc scv1
  237  kubectl describe svc vc1
  238  kubectl describe svc svc1
  239  kubectl get pods -o wide --show-labels
  240  kubectl edit svc svc1
  241  kubectl describe svc svc1
  242  vi pod1.yaml
  243  kubectl apply -f pod1.yaml
  244  kubectl describe svc svc1
  245  kubectl edit pod rajesh2
  246  kubectl describe svc svc1
  247  curl http://10.100.79.184
  248  curl http://10.100.79.184:5678
  249  clear
  250  kubectl create svc -h
Code language: PHP (php)
 251  history
  252  kubectl create svc -h
  253  kubectl create service clusterip np --tcp=5678:80 --type=NodePort
  254  kubectl create service nodeport np --tcp=5678:80
  255  kubectl get svc
  256  kubectl describe svc np
  257  kubectl edit svc np
  258* kubectl describe svc 0
  259  kubectl get pods --show-labels
  260  kubectl edit svc np
  261  kubectl get pods --show-labels
  262  kubectl describe svc np
  263  historyt
  264  history
  265  kubectl create svc -h
  266  kubectl create service loadbalancer lb --tcp=5678:80
  267  kubectl get svc
  268  kubectl edi svc lb
  269  kubectl edit svc lb
  270  kubectl get svc
  271  clear
  272  curl https://demo-415762973.ap-south-1.elb.amazonaws.com/
  273  curl https://demo-415762973.ap-south-1.elb.amazonaws.com
  274  curl http://demo-415762973.ap-south-1.elb.amazonaws.com
Code language: JavaScript (javascript)

PV AND PVC

DaemonSet 

Statefulset 

Day-1

Understanding the Need of Kubernetes 
Understanding Kubernetes Architecture 
Understanding Kubernetes Masters and its Component 
Understanding Kubernetes Nodes and its Component 
Understand Kubernetes Concepts 
Understand Kubernetes Terminology 
Kubernetes Clusters Requirements 
Understanding Kubernetes Clusters using kubeadm 
Understanding a concept of Namespace 
Demo: Define your first Kubernetes pod 
Demo: Working and Deep Dive with Kubernetes pod 
Understanding Kubernetes replication controllers 
Understanding Kubernetes deployments 
Demo: Working and Deep Dive with Kubernetes deployment 
Understanding Kubernetes Lebels 
Demo: Working with Kubernetes Lebels 
Understanding Kubernetes Services 
Demo: Working and Deep Dive with Kubernetes Services 

Day-2
Understanding Kubernetes Volumes
Understanding Types of Volumes
Static and Dynamic Provisioning
Understanding Persistent Volume and Persistent Volume Claim
Understanding ConfigMap and Secret Understanding Storage Class
Demo: Working with ConfigMap and Secret
Understanding StatefulSet and DaemonSet
Understanding CronJob and Job
What is a Kubernetes Pod networking?
How does networking work in Kubernetes?
How to implement Kubernetes networking? 
The Kubernetes network model
Kubernetes Network Plugins
Understanding Flannel Network Plugins
Understanding Project Calico Network Plugins
Understanding Weave Net Network Plugins
Demo: Implementing Project Calico Network Plugins
Understanding Ingress and Ingress Controllers
Understanding Network Policies
Understanding DNS for Services and Pods

Day-3
Understanding Kubernetes Pods Observability
Troubleshooting Control Plane Failure
Troubleshooting Worker Node Failure
Troubleshooting Networking 
Demo: Upgrading the Kubernetes Cluster 
Demo: Backing Up and Restoring a Kubernetes Cluster 
Monitoring the Cluster Components 
Monitoring the Applications Running within a Cluster
Managing Cluster Component Logs
Managing Application Logs 
CRDs 
Operators 




Code language: JavaScript (javascript)

Jobs and Cron jobs

SA ROLE ROLEBINDING

kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  namespace: rajesh
  name: rajesh-role
rules:
- apiGroups: ["", "extensions", "apps"]
  resources: ["deployments", "replicasets", "pods"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] 


kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: rajesh-binding
  namespace: rajesh
subjects:
- kind: User
  name: rajesh
  apiGroup: ""
roleRef:
  kind: Role
  name: rajesh-role
  apiGroup: ""Code language: JavaScript (javascript)

 388  clear
  389  ls
  390  pwd
  391  openssl genrsa -out rajesh.key 2048
  392  ls
  393  openssl req -new -key rajesh.key -out rajesh.csr -subj "/CN=rajesh/O=bitnami"
  394  ls
  395  openssl x509 -req -in rajesh.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out employee.crt -days 500
  396  ls
  397  openssl x509 -req -in rajesh.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out rajesh.crt -days 500
  398  ls
  399  rm -rf employee.crt
  400  ls
  401  clear
  402  kubectl config view
  403  kubectl config set-credentials rajesh --client-certificate=/root/rajesh/rajesh.crt  --client-key=/root/rajesh/rajesh.key
  404  kubectl config view
  405  clear
  406  kubectl config set-context rajesh-context --cluster=kubernetes --namespace=rajesh --user=rajesh
  407  kubectl config view
  408  kubectl create namespace rajesh
  409  kubectl --context=rajesh-context get pods
  410  clear
  411  kubectl get sa
  412  kubectl create sa devops
  413  kubectl get sa
  414  kubectl api-resources
  415  clear
  416  ls
  417  vi role.yaml
  418  kubectl get roles
  419  kubectl get rolesbinding
  420  kubectl apply -f role.yaml
  421  kubectl api-resources
  422  vi role.yaml
  423  kubectl apply -f role.yaml
  424  kubectl get roles
  425  kubectl get roles -n=rajesh
  426  clear
  427  vi rb.yaml;
  428  vi rb.yaml
  429  kubectl apply rb.yaml
  430  kubectl apply -f rb.yaml
  431  kubectl get rolebinding -n=rajesh
  432  kubectl --context=rajesh-context get pods
  433  kubectl --context=rajesh-context get svc
  434  kubectl api-resources
  435  clear
  436  kubectl --context=employee-context run nginx --image=nginx
  437  kubectl --context=rajesh-context run nginx --image=nginx
  438  kubectl get pods -n=rajesh
Code language: JavaScript (javascript)

Secret

Configmap

Operators

Network policy

How to take a backup and restore


Usage:
  kubeadm [command]

Available Commands:
  certs       Commands related to handling kubernetes certificates
  completion  Output shell completion code for the specified shell (bash or zsh)
  config      Manage configuration for a kubeadm cluster persisted in a ConfigMap in the cluster
  help        Help about any command
  init        Run this command in order to set up the Kubernetes control plane
  join        Run this on any machine you wish to join an existing cluster
  kubeconfig  Kubeconfig file utilities
  reset       Performs a best effort revert of changes made to this host by 'kubeadm init' or 'kubeadm join'
  token       Manage bootstrap tokens
  upgrade     Upgrade your cluster smoothly to a newer version with this command
  version     Print the version of kubeadm

Flags:
      --add-dir-header           If true, adds the file directory to the header of the log messages
  -h, --help                     help for kubeadm
      --log-file string          If non-empty, use this log file (no effect when -logtostderr=true)
      --log-file-max-size uint   Defines the maximum size a log file can grow to (no effect when -logtostderr=true). Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
      --one-output               If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)
      --rootfs string            [EXPERIMENTAL] The path to the 'real' host root filesystem.
      --skip-headers             If true, avoid header prefixes in the log messages
      --skip-log-headers         If true, avoid headers when opening log files (no Code language: PHP (php)

Monitoring

=====================================================
Obserbability and Monitoring
=====================================================
Collection -  Metrices + Logs + Trace
======================================================
			  Promethus + Elasticsearch + jaeger
Store ->
========================================================
Analysis ->	   Grafana  +   Kibana +  
Alerts 
Dashboard
 747  kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  748  kubectl top node
  749  kubectl get all
  750  kubectl get all --all-namespaces
  751  cleaer
  752  \clear
  753  kubectl get all -n=kube-systems
  754  kubectl get all -n=kube-system
  755  kubectl describe pod pod/metrics-server-856f767b-mf9nq -n=kube-systems
  756  kubectl describe pod pod/metrics-server-856f767b-mf9nq -n=kube-system
  757  clear
  758  kubectl describe pod/metrics-server-856f767b-mf9nq -n=kube-system
  759  kubectl logs pod/metrics-server-856f767b-mf9nq -n=kube-system
  760  clear
  761  history
  762  clear
  763  kubectl delete -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  764  wget https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  765  clear
  766  vi components.yaml
  767  kubectl apply -f components.yaml
  768  kubectl get all -n=kube-system
  769  kubectl top node
  770  kubectl top pod
Code language: JavaScript (javascript)

Notes –
Tutorials – https://www.devopsschool.com/blog/
Slides – https://www.devopsschool.com/slides/
Commands – https://www.devopsschool.com/commands
Videos – https://www.devopsschool.com/blog/top-4-youtube-channel-for-free-videos-tutorials/
How to reach out – https://www.rajeshkumar.xyz/

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x