- The document describes how to set up a Kubernetes cluster using Minikube locally and complete various operations like deploying pods and services.
- It shows commands to start Minikube, deploy Nginx pods with deployments and expose them via services, scale pods, edit files inside pods, and use the Kubernetes dashboard.
- The last steps clean up resources by deleting pods, services and stopping Minikube.
- The document describes how to set up a Kubernetes cluster using Minikube locally and complete various operations like deploying pods and services.
- It shows commands to start Minikube, deploy Nginx pods with deployments and expose them via services, scale pods, edit files inside pods, and use the Kubernetes dashboard.
- The last steps clean up resources by deleting pods, services and stopping Minikube.
-----------------------------------------Lancer le cluster sur minikube---------------------------------------
grassa@work-pc:~$ minikube start 😄 minikube v1.5.2 on Ubuntu 18.04 minikube v1.5.2 on Ubuntu 18.04 Automatically selected the 'kvm2' driver (alternates: [virtualbox none]) 💾 Downloading driver docker-machine-driver-kvm2: ,…... 🏄 Done! kubectl is now configured to use "minikube" Done! kubectl is now configured to use "minikube" ⚠ /usr/local/bin/kubectl is version 1.13.1, and is incompatible with Kubernetes 1.16.2. You will need to update /usr/local/bin/kubectl or use 'minikube kubectl' to connect with this cluster grassa@work-pc:~$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt- key add - OK grassa@work-pc:~$ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main grassa@work-pc:~$ sudo apt update Atteint :1 http://fr.archive.ubuntu.com/ubuntu bionic InRelease Atteint :2 https://repo.skype.com/deb stable InRelease Atteint :3 http://fr.archive.ubuntu.com/ubuntu bionic-updates InRelease … grassa@work-pc:~$ kubectl cluster-info Kubernetes master is running at https://192.168.39.44:8443 KubeDNS is running at https://192.168.39.44:8443/api/v1/namespaces/kube-system/services/kube- dns:dns/proxy
grassa@work-pc:~$ kubectl config view
grassa@work-pc:~$ kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready master 11m v1.16.2
-------------------------------------------------Lancer un pod en mode deployment----------------------
grassa@work-pc:~$ kubectl run mynginxapp --image=nginx:latest --port=80
kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version. Use kubectl run --generator=run-pod/v1 or ku bectl create instead. deployment.apps/mynginxapp created
----------------------------------------------Creer un service a ce deployment------------------------------
service/mynginxapp exposed grassa@work-pc:~$ kubectl get pods NAME READY STATUS RESTARTS AGE mynginxapp-756586fc-kv75b 0/1 ContainerCreating 0 17s grassa@work-pc:~$ kubectl get deployments NAME READY UP-TO-DATE AVAILABLE AGE mynginxapp 1/1 1 1 77s grassa@work-pc:~$ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 24m mynginxapp NodePort 10.102.204.114 <none> 80:32632/TCP 75s
-------------------------------------------Afficher l’URL et y acceder avec un navigateur----------------
grassa@work-pc:~$ minikube service mynginxapp --url
http://192.168.39.44:32632
-------------------------Lancement d’un autre pod et son service------------------------------------
grassa@work-pc:~$ kubectl run mynginxapp2 --image=nginx:latest –port=80