Advertisement
sandervanvugt

CKA day1 oct 23

Oct 19th, 2023
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. student@control:~/cka$ history
  2. 1 free -m
  3. 2 lscspu
  4. 3 lscpu
  5. 4 df -h
  6. 5 sudo apt install vim git -y
  7. 6 git clone https://github.com/sandervanvugt/cka
  8. 7 cd cka
  9. 8 ls
  10. 9 ./setup-container.sh
  11. 10 ./setup-kubetools.sh
  12. 11 sudo ./setup-kubetools.sh
  13. 12 history
  14. 13 sudo kubeadm init
  15. 14 mkdir -p $HOME/.kube
  16. 15 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  17. 16 sudo chown $(id -u):$(id -g) $HOME/.kube/config
  18. 17 kubectl get all
  19. 18 kubectl get pods -n kube-system
  20. 19 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
  21. 20 kubectl get ns
  22. 21 kubectl get all -n kube-system
  23. 22 kubectl get nodes
  24. 23 history
  25. 24 kubectl get all -n kube-system
  26. 25 history
  27. 26 kubectl create deploy testdeploy --image=nginx --replicas=3
  28. 27 sleep 10; kubectl get pods -o wide
  29. 28 kubectl run task2pod --image=nginx -n mynamespace -- sleep 3600
  30. 29 kubectl create ns mynamespace
  31. 30 kubectl run task2pod --image=nginx -n mynamespace -- sleep 3600
  32. 31 kubectl delete pod task2pod
  33. 32 kubectl get pods
  34. 33 source <(kubectl completion bash)
  35. 34 kubectl delete pod task2pod -n mynamespace
  36. 35 kubectl run task2pod --image=alpine -n mynamespace -- sleep 3600
  37. 36 kubectl get pods -n mynamespace
  38. 37 kubectl get pods -n mynamespace -o yaml | less
  39. 38 history
  40. 39 kubectl run task3pod --image=nginx --image=redis --image=busybox
  41. 40 kubectl get pods
  42. 41 kubectl get pods task3pod -o yaml | less
  43. 42 kubectl describe pod task3pod
  44. 43 kubectl delete pod task3pod
  45. 44 history
  46. 45 kubectl run task3pod --image=busybox --dry-run=client -o yaml -- sleep infinity
  47. 46 kubectl run task3pod --image=busybox --dry-run=client -o yaml -- sleep infinity > task3.yaml
  48. 47 vim task3.yaml
  49. 48 kubectl apply -f task3.yaml
  50. 49 kubectl get pods
  51. 50 cat task3.yaml
  52. 51 history
  53. 52 cat task3.yaml
  54. 53 history
  55. 54 vim task4pod.yaml
  56. 55 vim md4.yaml
  57. 56 kubectl apply -f md4.yaml
  58. 57 kubectl get pods
  59. 58 vim md4.yaml
  60. 59 history
  61. 60 kubectl create quota --help | less
  62. 61 kubectl create ns limited
  63. 62 kubectl create quota qtest --hard pods=3,cpu=100m,memory=500Mi --namespace limited
  64. 63 kubectl get quota
  65. 64 kubectl get quota -n limited
  66. 65 kubectl describe ns limited
  67. 66 kubectl create deploy nginx --image=nginx --replicas=3 -n limited
  68. 67 kubectl get all -n limited
  69. 68 kubectl describe rs -n limited nginx-7854ff8877
  70. 69 kubectl set resources --help | less
  71. 70 kubectl set resources deploy nginx -n limited --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi
  72. 71 history
  73. 72 kubectl get all -n limited
  74. 73 kubectl describe ns limited
  75. 74 kubectl edit -n limited quota
  76. 75 kubectl get all -n limited
  77. 76 kubectl scale -n limited deployment nginx --replicas=3
  78. 77 kubectl get all -n limited
  79. 78 kubectl scale -n limited deployment nginx --replicas=4
  80. 79 kubectl get all -n limited
  81. 80 kubectl scale -n limited deployment nginx --replicas=3
  82. 81 history
  83. 82 kubectl config view
  84. 83 history
  85. 84 less ~/.kube/config
  86. 85 kubectl config view
  87. 86 kubectl config --help
  88. 87 kubectl config current-context
  89. 88 kubectl config set-context --current --namespace=limited
  90. 89 kubectl config current-context
  91. 90 kubectl config view
  92. 91 kubectl config set-context --current --namespace=default
  93. 92 kubectl config view
  94. 93 history
  95. 94 kubectl create deploy nginxex5 --image=nginx --replicas=2
  96. 95 kubectl scale deployment nginxex5 --replicas=4
  97. 96 vim resize_pvc.yaml
  98. 97 history
  99. 98 vim nwpolicy-complete-example.yaml
  100. 99 kubectl apply -f nwpolicy-complete-example.yaml
  101. 100 kubectl expose pod nginx --port=80
  102. 101 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  103. 102 kubectl label pod busybox access=true
  104. 103 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  105. 104 kubectl create ns nwp-namespace
  106. 105 vim nwp-lab9-1.yaml
  107. 106 kubectl apply -f nwp-lab9-1.yaml
  108. 107 kubectl expose pod nwp-nginx --port=80
  109. 108 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx
  110. 109 kubectl exec -it nwp-busybox -n nwp-namespace -- nslookup nwp-nginx
  111. 110 kubectl exec -it nwp-busybox -n nwp-namespace -- nslookup nwp-nginx.default.svc.cluster.local
  112. 111 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
  113. 112 vim nwp-lab9-2.yaml
  114. 113 kubectl apply -f nwp-lab9-2.yaml
  115. 114 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
  116. 115 kubectl create deploy busybox --image=busybox -- sleep 36000
  117. 116 kubectl exec -it busybox-6b56f788cb-qsgj2 -- wget --spider --timeout=1 nwp-nginx
  118. 117 kubectl delete -f nwp-lab9-2.yaml
  119. 118 history
  120. 119 vim selector-pod.yaml
  121. 120 kubectl apply -f selector-pod.yaml
  122. 121 kubectl get pods
  123. 122 vim selector-pod.yaml
  124. 123 kubectl apply -f selector-pod.yaml
  125. 124 kubectl get all
  126. 125 kubectl describe pod nginxxx
  127. 126 kubectl label nodes worker2 disktype=ssd
  128. 127 kubectl get pods
  129. 128 kubectl edit nodes control
  130. 129 kubectl get pods -n kube-system -o wide
  131. 130 kubectl -n kube-system get daemonsets.apps calico-node -o yaml | less
  132. 131 kubectl taint nodes worker1 example-key=value1:NoSchedule
  133. 132 kubectl describe nodes worker1 | less
  134. 133 kubectl create deploy nginx-taint --image=nginx --replicas=3
  135. 134 kubectl get pods -o wide
  136. 135 vim taint-toleration.yaml
  137. 136 kubectl apply -f taint-toleration.yaml
  138. 137 kubectl get pods
  139. 138 kubectl get pods -o wide
  140. 139 kubectl taint nodes worker1 example-key=value1:NoSchedule-
  141. 140 kubectl get pods -o wide
  142. 141 kubectl scale deployment nginx-taint --replicas=1
  143. 142 kubectl scale deployment nginx-taint --replicas=3
  144. 143 kubectl get pods -o wide
  145. 144 history
  146.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement