Feb 09 3_14 PM (1)
Feb 09 3_14 PM (1)
CRIO
CONTAINERD
DOCKER - OPENSOURCED
PODMAN
RKLET
MOBY
REDHAT - PODMAN
GCP - DOCKER
AZURE - CONTAINERD
K8S
KUBERNETES
K3S
CMT
1. KUBERNETES
2. DOCKER SWARM
3. APACHE MESOS MARATHON
DEPLOYMENT
SCHEDULING
SCALING
LOAD BALANCING
BATCH EXECUTION
ROLLBACKS
MONITORING
FEATURES
IF CONTAINER DOES NOT RESPOND TO USER DEFINED HEALTH CHECKS - KILL CONTAINER
INSTALLATION STEPS
ON UBUNTU
Kubernetes Installation
———————————
Step 1
System names
Ubuntu-Master - 192.168.1.101
Ubuntu-Worker1 - 192.168.1.102
Ubuntu-Worker2 - 192.168.1.103
Third system
Step 2
IN ALL MACHINES
sudo apt-get update
Sudo apt-get install docker.io
docker —version
Enable the docker service Sudo su
Systemctl enable docker Systemctl start docker Systemctl status docker
Step 3
IN ALL MACHINES
IN ALL MACHINES
Add Kubernetes repo
Sudo apt-add-repository “deb http://apt.kubernetes.io/
kebernetes-cenial main”
Sudo apt-get install kubeadm kubelet kubectl
Sudo apt-mark hold kubeadm kubelet kubectl
Wait for 10 mins
Kubeadm version
Sudoswapoff-a (INALLMACHINES) Step 5
IN Ubuntu-Master Machine
Sudo kubeadm init —pod-network-cidr=10.244.0.0/16
It will display kubeadm join (KEEP BACKUP OF THE STATEMENT)
Mkdir -p $HOME/.kube
Sudo cp -I /etc/kubernetes/admin.conf $HOME/.kube/ config
Sudo chown $(id -u):$(id -g) $HOME/.kube/config Sudo kubectl apply
https://raw.githubusercontent.com/
coreos/flannel/master/Documentation/kube-flannel.yml
Kubectl get pods —all-namespaces
Step 6
-----------------------
https://github.com/justmeandopensource/kubernetes/blob/master/docs/install-cluster-
centos-7.md
Q 01) #Create a new pod called admin-pod with image busybox. Allow it to be able to
set system_time. Container should sleep for 3200 seconds.
15 alias g=kubectl
16 kubectl run admin-pod --image=busybox --command sleep 3200 --dry-run=client
-o yaml
17 kubectl run admin-pod --image=busybox --command sleep 3200 --dry-run=client
-o yaml | tee admin-pod-1.yml
18 echo ' securityContext:
capabilities:
add: ["NET_ADMIN", "SYS_TIME"]' | tee -a admin-pod-1.yml
19 kubectl create -f admin-pod-1.yml
20 kubectl create -f admin-pod-1.yml
21 kubectl get po
22 kubect describe pod admin-pod
23 kubectl describe pod admin-pod
24 kubectl describe pod admin-pod
25 kubectl get po
26 kubectl get po
27 kubectl describe pod admin-pod
28 kubectl describe pod admin-pod
29 kubectl get po
==========
To check the running sleep command in above container:
kubectl exec -i -t admin-pod -- /bin/sh
/ #
/ #
/ #
/ #
/ # ps -ef | grep sleep
1 root 0:00 sleep 3200
27 root 0:00 grep sleep
/ #
/ #
39 g delete -f example1.yml
40 g delete -f admin-pod-2.yml
41 g create -f example3.yml
42 g get po
43 g get po -o wide
44 g get po -l app=tomcat-app
45 g describe rc tomcat-rc
46 g scale rc tomcat-rc --replicas=8
47 g get po -l app=tomcat-app
48 g scale rc tomcat-rc --replicas=3
49 g get po -l app=tomcat-app
50 kubectl delete rc tomcat-rc
51 g get po -l app=tomcat-app
52 history
Q . deploy a web-load-5461 pod using nginx:1.17 with the label set to tier=web
OPERATORS :
=, ==, !=
EXAMPLES
Environment = production
Tier != frontend
command line
in manifest
selector :
environment : production
tier : fronend
operators :
Examples
command line
in manifest
selector :
matchExpressios :
- {key : environment, operator : in, values : [prod, qa]}
- {key : tier, operator : NotIn, values : [frontend, backend]}
56 g create -f example4.yml
57 kubectl get po
58 g get po -l tier=frontend
59 g get rs tomcat-rs -o wide
60 kubectl get po -o wide
61 g scale rs tomcat-rs -- replicas=5
62 g scale rs tomcat-rs --replicas=5
63 g scale rs tomcat-rs --replicas=9
64 kubectl get po -o wide
65 g scale rs tomcat-rs --replicas=4
66 kubectl get po -o wide
67 g delete pod tomcat-rs-hc8fv
68 kubectl get po -o wide
69 g delete pod tomcat-rs-qk5lh
70 kubectl get po -o wide
71 g delete rs tomcat-rs
72 kubectl get po -o wide
73 history
92 g get po
93 g create -f example5.yml
94 g get po
95 g get rs
96 kubectl describe deploy tomcat-deploy
97 history
ps -ef|grep kubelet
sudo grep static /var/lib/kubelet/config.yaml
sudo cp static-pod.yaml /etc/kubernetes/manifests/.
ls /etc/kubernetes/manifests
apiVersion : v1
kind : PersistentVolume
metadata :
name : kube-pv
labels :
type : local
spec :
storageClassName : manual
capacity :
storage : 1Gi
accessModes :
- ReadWriteOnce
hostPath :
path : /mnt/datas
management.endpoints.enabled-by-default=true
management.endpoint.info.enabled=true
management.security.enabled=false
management.endpoints.web.exposure.include=*
application2.properties
server.port= 9000
server.servlet.context-path=/oracle
oracleprops.greeting= Thank you and visit again - altered
oracleprops.greeting1= New Data