Advertisement
sandervanvugt

CKA dec22 day1

Dec 12th, 2022
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1. student@control:~/cka$ history
  2. 1 sudo apt install vim git -y
  3. 2 git clone https://github.com/sandervanvugt/cka
  4. 3 cd cka
  5. 4 ls
  6. 5 sudo ./setup-container.sh
  7. 6 ls
  8. 7 sudo ./setup-kubetools-specific-version.sh
  9. 8 history
  10. 9 sudo kubeadm init
  11. 10 mkdir -p $HOME/.kube
  12. 11 kubectl get all
  13. 12 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
  14. 13 history
  15. 14 kubectl get nodes
  16. 15 kubectl create deploy testginx --image=nginx --replicas=3
  17. 16 source <(kubectl completion bash)
  18. 17 kubectl get all
  19. 18 ./counter.sh 20
  20. 19 history
  21. 20 sudo kubeadm token create --print-join-command
  22. 21 sudo kubeadm --help | less
  23. 22 kubectl create ns mynamespace
  24. 23 kubectl run alpine --image alpine --command sleep 3600 --restart Always -n mynamespace
  25. 24 kubectl run -h | less
  26. 25 kubectl get pods
  27. 26 kubectl get pods -n mynamespace
  28. 27 kubectl get pods -n mynamespace -o yaml | less
  29. 28 history
  30. 29 ls
  31. 30 history
  32. 31 vim ah.yaml
  33. 32 kubectl apply -f ah.yaml
  34. 33 kubectl get pods
  35. 34 vim ah.yaml
  36. 35 history
  37. 36 vim lab4.yaml
  38. 37 kubectl apply -f lab4.yaml
  39. 38 kubectl get pods
  40. 39 cat lab4.yaml
  41. 40 kubectl create ns limited
  42. 41 kubectl create quota -h | less
  43. 42 kubectl create quota qtest --hard pods=3,cpu=100m,memory=500Mi -n limited
  44. 43 kubectl describe ns limited
  45. 44 kubectl describe quota -n limited
  46. 45 kubectl create deploy nginx --image=nginx --replicas=3 -n limited
  47. 46 kubectl get all -n limited
  48. 47 kubectl describe -n limited replicasets.apps nginx-8f458dc5b
  49. 48 kubectl set resources -h | less
  50. 49 kubectl set resources -n limited deploy nginx --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi
  51. 50 kubectl get all -n limited
  52. 51 kubectl describe ns limited
  53. 52 kubectl edit quota -n limited
  54. 53 kubectl describe ns limited
  55. 54 kubectl scale deploy -n limited nginx --replicas=4
  56. 55 kubectl scale deploy -n limited nginx --replicas=3
  57. 56 kubectl describe ns limited
  58. 57 kubectl set resources -n limited deploy nginx --requests cpu=100m,memory=5Gi --limits cpu=200m,memory=20Gi
  59. 58 kubectl get all -n limited
  60. 59 kubectl scale deploy -n limited nginx --replicas=0
  61. 60 kubectl scale deploy -n limited nginx --replicas=3
  62. 61 kubectl get all -n limited
  63. 62 kubectl describe -n limited rs nginx-5bc7db48df
  64. 63 history
  65. 64 ./counter.sh 10
  66. 65 history
  67. 66 kubectl create deploy nginx-ex5 --image=nginx --replicas=2
  68. 67 kubectl get all --selector app=nginx-ex5
  69. 68 kubectl scale deployment nginx-ex5 --replicas=4
  70. 69 kubectl get all --selector app=nginx-ex5
  71. 70 history
  72. 71 kubectl create deploy lab9 --image=nginx:1.14 --replicas=4 --dry-run=client -o yaml > lab9.yaml
  73. 72 vim lab9.yaml
  74. 73 kubectl explain deploy.spec.strategy
  75. 74 kubectl explain --recursive deploy.spec.strategy
  76. 75 kubectl explain deploy.spec.strategy
  77. 76 vim lab9.yaml
  78. 77 kubectl apply -f lab9.yaml
  79. 78 kubectl explain deployment.spec
  80. 79 kubectl explain deployment.spec.strategy
  81. 80 kubectl apply -f lab9.yaml
  82. 81 vim lab9.yaml
  83. 82 kubectl apply -f lab9.yaml
  84. 83 kubectl set image deploy lab9 nginx=nginx:latest
  85. 84 kubectl rollout history deploy lab9
  86. 85 kubectl rollout undo deploy lab9
  87. 86 history
  88. 87 vim nwpolicy-complete-example.yaml
  89. 88 kubectl apply -f nwpolicy-complete-example.yaml
  90. 89 kubectl expose pod nginx --port=80
  91. 90 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  92. 91 kubectl label pod busybox access=true
  93. 92 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  94. 93 kubectl create ns nwp-namespace
  95. 94 vim nwp-lab9-1.yaml
  96. 95 kubectl create -f nwp-lab9-1.yaml
  97. 96 kubectl expose pod nwp-nginx --port=80
  98. 97 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx
  99. 98 kubectl exec -it nwp-busybox -n nwp-namespace -- nslookup nwp-nginx
  100. 99 kubectl exec -it nwp-busybox -n nwp-namespace -- nslookup nwp-nginx.default.svc.cluster.local
  101. 100 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
  102. 101 vim nwp-lab9-2.yaml
  103. 102 kubectl create -f nwp-lab9-2.yaml
  104. 103 kubectl exec -it nwp-busybox -n nwp-namespace -- wget --spider --timeout=1 nwp-nginx.default.svc.cluster.local
  105. 104 kubectl create deployment busybox --image=busybox -- sleep 3600
  106. 105 kubectl exec -it busybox-6588d4995c-hwqxl -- wget --spider --timeout=1 nwp-nginx
  107. 106 history
  108. 107 vim lab9.yaml
  109. 108 vim lab9ah.yaml
  110. 109 vim lab9-ab.yaml
  111. 110 kubectl get ns default -o yaml
  112. 111 vim lab9.yaml
  113. 112 ls lab*
  114. 113 cat lesson9lab.yaml
  115. 114 kubectl get nodes
  116. 115 kubectl drain -h | less
  117. 116 kubectl get pods -o wide
  118. 117 kubectl drain worker2
  119. 118 kubectl drain worker2 --ignore-daemonsets --force
  120. 119 kubectl get pods -o wide
  121. 120 #kubectl drain worker2
  122. 121 kubectl get nodes
  123. 122 kubectl describe node worker2 | less
  124. 123 kubectl uncordon node worker2
  125. 124 kubectl uncordon worker2
  126. 125 kubectl get nodes
  127. 126 history
  128. 127 kubectl get nodes
  129. 128 kubectl get pods -o wide
  130. 129 kubectl create deploy manyginx --image=nginx --replicas=8
  131. 130 kubectl get pods -o wide
  132. 131 sudo ls -l /etc/kubernetes/manifests
  133. 132 sudo less /etc/kubernetes/manifests/etcd.yaml
  134. 133 kubectl run myweb --image=nginx --dry-run=client -o yaml
  135. 134 kubectl get pods -o wide
  136. 135 history
  137.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement