Differences

This shows you the differences between two versions of the page.

Link to this comparison view

devops:laboratoare:05 [2021/07/28 15:46]
bogdan.croitoru
— (current)
Line 1: Line 1:
-===== Laboratorul 05. Kubernetes ===== 
  
-==== 5.1. Pods ==== 
- 
-<note tip>​Nota:​ pe parcursul laboratoarelor de mai jos, va rog sa inlocuiti **"​id"​** cu numarul aferent fiecarui student.</​note>​ 
- 
-  * Adaugam credentialele pentru clusterul de kubernetes 
- 
-<​note>​mkdir ~/.kube 
-cp config ~/.kube 
- 
-$ kubectl get nodes</​note>​ 
- 
-  * Observam contextul actual folosit 
-  * Verificam conexiunea si observam contextul folosit 
- 
-<​note>​kubectl config view</​note>​ 
- 
-  * Creare namespace student. 
- 
-  * Fiecare student isi va crea propriul namespace, folosind id-ul student aferent. 
- 
-<​note>​kubectl create ns student[id] 
- 
-kubectl get ns</​note>​ 
- 
-  * Configuram kubectl sa foloseasca ca namespace implicit namespace-ul propriu. 
- 
-<​note>​kubectl config set-context --current --namespace=student[id] 
- 
-kubectl config view</​note>​ 
- 
-  * Editam fisierul "​pod01.yaml"​ cu id-ul aferent fiecarui student, apoi creem un pod conform definitiei din fisier. Pod-ul se va crea in aproximativ 10 secunde. Observati output-ul celor doua comenzi get. Folositi id-ul aferent. 
- 
-<​note>​kubectl apply -f pod01.yaml 
- 
-kubectl get pods  
- 
-kubectl get pods webserver-student-id -owide 
- 
-kubectl get pods webserver-student-id -oyaml 
-</​note>​ 
- 
-  * Intram in pod-ul nou creat si observam. 
- 
-<​note>​kubectl exec -it webserver-student-id -- bash</​note>​ 
- 
-<​note>​root@webserver-student-id:/#​ cat /​etc/​os-release 
- 
-PRETTY_NAME="​Debian GNU/Linux 10 (buster)"​ 
- 
-NAME="​Debian GNU/​Linux"​ 
- 
-VERSION_ID="​10"​ 
- 
-VERSION="​10 (buster)"​ 
- 
-VERSION_CODENAME=buster 
- 
-ID=debian 
- 
-HOME_URL="​https://​www.debian.org/"​ 
- 
-SUPPORT_URL="​https://​www.debian.org/​support"​ 
- 
-BUG_REPORT_URL="​https://​bugs.debian.org/"​ 
- 
-root@webserver-student-id:/#​ exit 
- 
-kubectl logs webserver-student-id</​note>​ 
- 
-  * Stergem pod-ul creat anterior. 
- 
-<​note>​kubectl delete pod webserver-student-id 
- 
-kubectl get po -o wide # Should output "No resources found."</​note>​ 
- 
-  * Cream un pod ce contine doua containere 
- 
-<​note>​kubectl apply -f pod02.yaml 
- 
-kubectl get po -o wide 
- 
-kubectl describe pod webserver</​note>​ 
- 
-  * Rulati comenzile urmatoare una cate una si observati ca va aflati in containere diferite ale aceluiasi pod. 
- 
-<​note>​kubectl exec -it webserver -c webwatcher -- /bin/bash 
- 
-root@webserver:/#​ cat /​etc/​os-release 
- 
-kubectl exec -it webserver -c webserver -- /bin/bash 
- 
-root@webserver:/#​ cat /​etc/​os-release 
-</​note>​ 
-  * Stergem ceea ce am creat folosind comanda de mai jos 
- 
-<​note>​kubectl delete -f pod02.yaml</​note>​ 
- 
-  * Cream pod-ul 3 folosind fisierul pod03.yaml. Avem dooua containere care impart acelasi volum. 
- 
-<​note>​kubectl apply -f pod03.yaml</​note>​ 
- 
-  * Observati in definitia pod-ului cum este montat volumul html in cele doua containere 
-  * Mai departe verificam faptul ca aceleasi date sunt prezente in ambele containere 
- 
-<​note>​kubectl exec webserver -c c1 -- /bin/cat /​usr/​share/​nginx/​html/​index.html 
- 
-kubectl exec webserver -c c2 -- /bin/cat /​html/​index.html 
-</​note>​ 
-  * Stergem pod-ul creat anterior 
- 
-<​note>​kubectl delete pod webserver</​note>​ 
- 
-  * Pentru partea a 2-a (din 3) a laboratorului,​ rulati comanda: 
- 
-<​note>​cd ../​Laborator2</​note>​ 
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0