-
Notifications
You must be signed in to change notification settings - Fork 1
/
Kubernetes challenges.sh
105 lines (63 loc) · 1.91 KB
/
Kubernetes challenges.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
######################################## Kubernetes challenges 2 ############################################################
######################################## Control plane ##########
#checking cluster is run or fail
kubectl get nodes
#change the port in config file
vi .kube/config
edit controlplane no to 6443
kubectl get nodes
#checking docker running container
docker ps
#checking logs of kube api
docker ps -a | grep -i api
#checking why kube api is exit
#read the error
docker logs <container-id>
#have static pods defintion file
cd /etc/kubernetes/mainfests/
ls
vi kube-apiserver.yaml
#not fount crt file
ls /etc/kubernetes/pki/ca-*.crt
ls /etc/kubernetes/pki/ca*
#so we edit again
vi kube-apiserver.yaml
#change path
--client-ca-file=/etc/kubernetes/pki/ca.crt
#finding image under kube-system and show deployment
kubectl get deployment -n kube-system
kubectl edit deployment -n kube-system <deployment-name>
edit image name
#checking cluster is ready or not
kubectl get deployment -n kube-system
######################################## node01 ##########
docker ps
#enable node01
kubectl uncordon node01
kubectl get nodes
######################################## /web ##########
cd /media
scp kodekloud-ckad.png node01:/web
scp kodekloud-cka.png node01:/web
scp kodekloud-cks.png node01:/web
cd ..
######################################## data-pv pvc##########
vi pvc.yaml
paste from github
kubectl apply -f pvc.yaml
#status to bound
kubectl get pvc
######################################## port and service##########
vi pod.yaml
kubectl apply -f pod.yaml
#pod is running now
kubectl get all
######################################## Kubernetes challenges 4 ############################################################
#check kubectl config map is have or not
kubectl get cm
kubectl describe cm redis-cluster-configmap
vi pv.yaml
kubectl apply -f pv.yaml
#validate
kubectl get pv
kubectl get all