Lab1 Solution
Premier Pod
Créer un pod nommé web basé sur une image nginx
vi web.ymlapiVersion: v1kind: Podmetadata: name: webspec: containers: - name: www image: nginx:1.21-alpine kubectl apply -f web.ymlDeuxième Pod
Créer un pod nommé debug basé sur une image alpine
vi debug.ymlapiVersion: v1kind: Podmetadata: name: debugspec: containers: - name: debug image: alpine:3.17 command: ["sleep","3600"] kubectl apply -f debug.ymlSe connecter sur le pod debug et faire un curl sur l’IP du pod web
kubectl exec -it debug -- sh apk add curl curl <IP WEB>Troisième Pod
Créer un pod nommé all basé sur 2 conteneurs (nginx et alpine)
vi all.ymlapiVersion: v1kind: Podmetadata: name: allspec: containers: - name: www image: nginx:1.21-alpine - name: debug image: alpine:3.17 command: ["sleep","3600"] kubectl apply -f all.ymlSe connecter sur le pod all dans le conteneur alpine et faire un curl sur l’IP localhost
kubectl exec -it all -c debug -- sh apk add curl curl 127.0.0.1