This project aims to deepen your knowledge by making you use K3d
and K3s
with
Vagrant.
You will learn how to set up a personal virtual machine with Vagrant
and the
distribution of your choice. Then, you will learn how to use K3s
and its Ingress
.
Last but not least, you will discover K3d
that will simplify your life.
In the p1, you will learn how to set up a personal virtual machine with Vagrant
and the distribution of your choice. Then, you will learn how to use K3s
in
server mode and agent mode.
## to launch the p1
vagrant up
## connect with ssh via the name of the VM
vagrant ssh $NAME
For the SSH connection, use the private key in the .vagrant folder, located at:
.vagrant/machines/NAME_OF_THE_VM/virtualbox/private_key
ssh -i .vagrant/machines/bapasquiS/virtualbox/private_key [email protected]
ssh -i .vagrant/machines/bapasquiSW/virtualbox/private_key [email protected]
- K3s: Lightweight Kubernetes distribution.
- Vagrant: Tool for building and managing virtual machine environments in a single workflow.
In this second part, you will learn how to use k3s
, Ingress
, and all terms related to Kubernetes.
## to launch the p2
vagrant up
## to get the ingress
kubectl get ingress -o wide
# Setup domain local name in /etc/hosts
# might need to use .local since .com already in use by a real domain
192.168.56.110 app1.com
192.168.56.110 app2.com
192.168.56.110 app3.com
- Pod: Group of containers that run your application.
- Deployment: Manages and automates the creation and management of Pods via a ReplicaSet.
- ReplicaSet: Ensures the correct number of Pods are running.
- Service: Connects the Pods to each other or to the outside world.
- Ingress : Exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.
The Webpage for the Deployment
In this last part, you will learn how to use K3d
and ArgoCD
to deploy your application.
## to launch the p3
sudo bash scripts/start.sh
# get the name of the pod
kubectl get pods -n dev
#port-forward for curl
kubectl port-forward -n dev pod/<pod-name> 8888:8888
- ArgoCD: Continuous Delivery tool for Kubernetes.
- v2 and v1 are the two versions of the application.
- k3d is a lightweight wrapper to run k3s (Rancher Lab's minimal Kubernetes distribution) in Docker.
- K3s is a lightweight Kubernetes distribution.
In the bonus part, you should setup a Gitlab
instance and deploy the application with ArgoCD
.
## to launch the bonus (and p3 argocd)
sudo bash bonus/scripts/start.sh
## to stop the bonus and delete
sudo bash bonus/scripts/delete.sh
The creation of the repository is done automatically by the script bonus/scripts/start.sh
.
The repo will be name test
and the user root
.
To make ArgoCD
use the repo on the gitlab
use the following command:
# this will update the ip and push the p3 to the gitlab repo
sudo bash bonus/scripts/update_argoc.sh
vagrant up
: Launch the VMs in listed in the Vagrantfilevagrant destroy [-f]
: Delete all VMs listed in the Vagrantfilevboxmanage list vms
: lists all VMs in virtualboxvagrant provision
: Update the VM with the modifications in the Vagrantfile.kubectl get nodes
: List all the nodes.vagrant reload
: Delete all machines and re-up them.vagrant halt
: Shutdown the VM linked to the Vagrantfile.