Differences

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

Link to this comparison view

cc:laboratoare:06 [2021/11/21 19:48]
alexandru.hogea [Deployment-ul aplicatiei de laborator folosind YAML]
cc:laboratoare:06 [2021/11/22 13:20] (current)
alexandru.hogea [Deployment-ul aplicatiei de laborator folosind YAML]
Line 16: Line 16:
 metadata: metadata:
   name: nginx   name: nginx
 +  labels:
 +    run: nginx
 +    whatever: dude
 spec: spec:
  ​containers:​  ​containers:​
Line 24: Line 27:
 </​code>​ </​code>​
  
-Pentru a genera fișiere YAML plecand de la o comanda imperativa putem folosi flag-urile ''​--dry-run=client -o yaml''​. Exemplu: ''​kubectl run nginx--image=nginx --dry-run=client -o yaml''​+Pentru a genera fișiere YAML plecand de la o comanda imperativa putem folosi flag-urile ''​--dry-run=client -o yaml''​. Exemplu: ''​kubectl run nginx - -image=nginx - -dry-run=client -o yaml''​
  
 Orice fișier YAML are 4 [[https://​kubernetes.io/​docs/​concepts/​overview/​working-with-objects/​kubernetes-objects/​|componente]] importante: ​ Orice fișier YAML are 4 [[https://​kubernetes.io/​docs/​concepts/​overview/​working-with-objects/​kubernetes-objects/​|componente]] importante: ​
Line 190: Line 193:
 <code yaml> <code yaml>
     env:     env:
-    - name: PORT 
-      value: "​8000"​ 
     - name: PGHOST     - name: PGHOST
       value: db-cluster-ip-service       value: db-cluster-ip-service
Line 246: Line 247:
   type: NodePort   type: NodePort
 </​code>​ </​code>​
 +
 +=== Tips & Tricks ===
 +<note tip> Puteti sa rulati toate configuratiile de yaml daca sunt puse impreuna intr-un folder, folosind ''​kubectl apply -R -f NumeFolder''</​note>​
 +{{:​cc:​laboratoare:​structurafolder.png|}}
 +<code bash>
 +kubectl apply -R -f .\Deployment\
 +</​code>​
 +<note tip> ​
 +Puteti sa scrieti mai multe definitii in acelasi fisier YAML, daca separati definitiile prin **-****-****-**
 +</​note>​
 +<code yaml>
 +apiVersion: v1
 +kind: Pod
 +metadata:
 +  name: db
 +  labels:
 +    tip: gigica
 +spec:
 +  containers:
 +    - image: axonedge/​lab-k8s-database
 +      name: db
 +      env:
 +      - name: POSTGRES_USER
 +        value: student
 +      - name: POSTGRES_PASSWORD
 +        value: student
 +      - name: POSTGRES_DB
 +        value: library
 +---
 +apiVersion: v1
 +kind: Service
 +metadata:
 +  name: db-clusterip-service
 +spec:
 +  selector:
 +    tip: gigica
 +  ports:
 +    - port: 5432
 +      targetPort: 5432
 +  type: ClusterIP
 +</​code>​
 +==== Ce urmeaza? ====
 +Cu aceasta teorie pusa in practica, am reusit sa acoperim o parte consistenta din baza kubernetes. Cu toate acestea, inca nu am terminat. La laboratorul urmator vom invata urmatoarele:​
 +   * stocare persistenta (PV & PVC)
 +   * secrete (Secrets)
 +   * configurari (ConfigMaps)
 +   * load balancer (LoadBalancer Service)
 +
 +=== Tema optionala ===
 +
 +Adaptati configuratiile facute astazi, transformand pod-urile in deployment-uri. Api-ul ar trebui sa aiba 2 replici, clientul de rabbit 3 si baza de date 1.
cc/laboratoare/06.1637516890.txt.gz · Last modified: 2021/11/21 19:48 by alexandru.hogea
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