127 lines
5.1 KiB
Plaintext
127 lines
5.1 KiB
Plaintext
student@control:~/cka$ history
|
|
1 ip a
|
|
2 sudo apt install git vim -y
|
|
3 git clone https://github.com/sandervanvugt/cka
|
|
4 cd cka
|
|
5 ls *sh
|
|
6 ./setup-container.sh
|
|
7 ls
|
|
8 ls *sh
|
|
9 ./setup-kubetools-previousversion.sh
|
|
10 sudo apt install jq -y
|
|
11 history
|
|
12 sudo kubeadm init
|
|
13 history
|
|
14 mkdir ~/.kube
|
|
15 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
|
16 sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
|
17 kubectl get all
|
|
18 #kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
|
|
19 kubectl get pods -n kube-system
|
|
20 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
|
|
21 kubectl get pods -n kube-system
|
|
22 kubectl get ds -n kube-system
|
|
23 kubectl get nodes
|
|
24 history
|
|
25 kubectl create testapp --image=nginx --replicas=3
|
|
26 kubectl create deploy testapp --image=nginx --replicas=3
|
|
27 kubectl get all -o wide
|
|
28 history
|
|
29 cd ..
|
|
30 ls
|
|
31 tar xvf helm-v3.14.4-linux-amd64.tar.gz
|
|
32 sudo mv linux-amd64/helm /usr/local/bin
|
|
33 helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
|
|
34 source <(kubectl completion bash)
|
|
35 kubectl get pods -n ingress-nginx
|
|
36 kubectl create deploy nginxsvc --image=nginx --replicas=3
|
|
37 kubectl get all --selector app=nginxsvc
|
|
38 kubectl expose deploy nginxsvc
|
|
39 kubectl expose deploy nginxsvc --port=80
|
|
40 kubectl get all --selector app=nginxsvc
|
|
41 kubectl describe svc nginxsvc
|
|
42 kubectl create ingress nginxsvc --class=nginx --rule=nginxsvc.info/*=nginxsvc:80
|
|
43 kubectl describe ing nginxsvc
|
|
44 sudo vim /etc/hosts
|
|
45 kubectl port-forward -n ingress-nginx svc/ingress-nginx-controller 8080:80
|
|
46 bg
|
|
47 curl nginxsvc.info
|
|
48 curl nginxsvc.info:8080
|
|
49 history
|
|
50 curl nginxsvc.info:8080
|
|
51 kubectl edit svc nginxsvc
|
|
52 curl nginxsvc.info:8080
|
|
53 kubectl describe ing nginxsvc
|
|
54 kubectl describe svc nginxsvc
|
|
55 kubectl edit svc nginxsvc
|
|
56 curl nginxsvc.info:8080
|
|
57 history
|
|
58 kubectl create ns limited
|
|
59 kubectl create quota -h | less
|
|
60 kubectl create quota qtest --hard pods=3,cpu=100m,memory=500Mi --namespace=limited
|
|
61 kubectl describe quota -n limited
|
|
62 kubectl describe ns limited
|
|
63 kubectl create deploy nginx --image=nginx --replicas=3 -n limited
|
|
64 kubectl get all -n limited
|
|
65 kubectl describe -n limited rs nginx-7854ff8877
|
|
66 kubectl describe ns limited
|
|
67 kubectl set resources -h | less
|
|
68 kubectl set -n limited resources deploy nginx --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi
|
|
69 kubectl get all -n limited
|
|
70 kubectl describe ns limited
|
|
71 kubectl edit quota -n limited qtest
|
|
72 kubectl describe ns limited
|
|
73 kubectl scale -n limited deployment nginx --replicas=2
|
|
74 kubectl scale -n limited deployment nginx --replicas=3
|
|
75 kubectl describe ns limited
|
|
76 history
|
|
77 kubectl edit node control
|
|
78 kubectl cordon worker1
|
|
79 kubectl edit node worker1
|
|
80 kubectl get nodes
|
|
81 kubectl uncordon worker1
|
|
82 kubectl get pods -n kube-system
|
|
83 kubectl drain node worker1
|
|
84 kubectl drain worker1
|
|
85 kubectl get nodes
|
|
86 kubectl edit node worker1
|
|
87 kubectl get nodes
|
|
88 kubectl get pods -o wide
|
|
89 kubectl drain worker1
|
|
90 kubectl get nodes
|
|
91 kubectl drain worker1 --ignore-daemonsets
|
|
92 kubectl edit node worker1
|
|
93 kubectl get pods -o wide
|
|
94 kubectl get nodes
|
|
95 kubectl create deploy ready --image=nginx --replicas=3
|
|
96 kubectl get pods -o wide --selector app=ready
|
|
97 kubectl get nodes
|
|
98 kubectl scale deploy ready --replicas=0
|
|
99 kubectl scale deploy ready --replicas=3
|
|
100 kubectl get pods -o wide --selector app=ready
|
|
101 cd cka/
|
|
102 vim networkpolicy-example.yaml
|
|
103 git pull
|
|
104 vim nwpolicy-complete-example.yaml
|
|
105 kubectl apply -f nwpolicy-complete-example.yaml
|
|
106 kubectl expose pod nginx --port=80
|
|
107 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
|
|
108 kubectl label pod busybox access=true
|
|
109 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
|
|
110 kubectl create ns nwp-namespace
|
|
111 vim nwp-lab9-1.yaml
|
|
112 kubectl apply -f nwp-lab9-1.yaml
|
|
113 kubectl expose pod nwp-nginx --port=80
|
|
114 kubectl exec -n nwp-namespace nwp-busybox -- wget --spider --timeout=1 nwp-nginx
|
|
115 kubectl exec -n nwp-namespace nwp-busybox -- nslookup nwp-nginx
|
|
116 kubectl exec -n nwp-namespace nwp-busybox -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
|
|
117 vim nwp-lab9-2.yaml
|
|
118 kubectl apply -f nwp-lab9-2.yaml
|
|
119 kubectl exec -n nwp-namespace nwp-busybox -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
|
|
120 kubectl create deploy busybox --image=busybox -- sleep 3600
|
|
121 kubectl exec -it busybox-6fc6c44c5b-x5vrx -- wget --spider --timeput=1 nwp-nginx
|
|
122 kubectl exec -it busybox-6fc6c44c5b-x5vrx -- wget --spider --timeout=1 nwp-nginx
|
|
123 kubectl delete -f nwp-lab9-2.yaml
|
|
124 history
|
|
|