Compare commits

...

7 Commits

11 changed files with 33 additions and 69 deletions

View File

@ -1,5 +1,5 @@
# Inception of Things # Inception of Things
A project of 42 school entirely made in Peer to Peer learning with my mate Unai A project of 42 school entirely made in Peer Programming with my mate Unai
## Purpose ## Purpose
Discover [Kubernetes](https://kubernetes.io/), [Vagrant](https://developer.hashicorp.com/vagrant), [ArgoCD](https://argo-cd.readthedocs.io/en/stable/) Discover [Kubernetes](https://kubernetes.io/), [Vagrant](https://developer.hashicorp.com/vagrant), [ArgoCD](https://argo-cd.readthedocs.io/en/stable/)
@ -8,3 +8,5 @@ Discover [Kubernetes](https://kubernetes.io/), [Vagrant](https://developer.hashi
- Install ArgoCD and setup an ArgoCD pipeline with a github repository - Install ArgoCD and setup an ArgoCD pipeline with a github repository
- Deploy a gitlab instance on k3d cluster - Deploy a gitlab instance on k3d cluster
- Create an Ingress config - Create an Ingress config
## [Subject](./en.subject.pdf)

15
p1/Vagrantfile vendored
View File

@ -1,13 +1,12 @@
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "nfs" config.vm.box = "bento/debian-12"
config.vm.box = "debian/buster64"
config.vm.define "cchauvetS" do |server| config.vm.define "cchauvetS" do |server|
server.vm.hostname = "cchauvetS" server.vm.hostname = "cchauvetS"
server.vm.network "private_network", :ip => "192.168.56.110" server.vm.network "private_network", :ip => "192.168.56.110"
server.vm.provider "libvirt" do |lv| server.vm.provider "virtualbox" do |vb|
lv.memory = "2048" vb.memory = "2048"
lv.cpus = "2" vb.cpus = "2"
end end
server.vm.provision "shell", path: "scripts/server.sh" server.vm.provision "shell", path: "scripts/server.sh"
end end
@ -15,9 +14,9 @@ Vagrant.configure("2") do |config|
config.vm.define "cchauvetSW" do |agent| config.vm.define "cchauvetSW" do |agent|
agent.vm.hostname = "cchauvetSW" agent.vm.hostname = "cchauvetSW"
agent.vm.network "private_network", :ip => "192.168.56.111" agent.vm.network "private_network", :ip => "192.168.56.111"
agent.vm.provider "libvirt" do |lv| agent.vm.provider "virtualbox" do |vb|
lv.memory = "512" vb.memory = "512"
lv.cpus = "1" vb.cpus = "1"
end end
agent.vm.provision "shell", path: "scripts/agent.sh", args: ["192.168.56.110"] agent.vm.provision "shell", path: "scripts/agent.sh", args: ["192.168.56.110"]
end end

9
p2/Vagrantfile vendored
View File

@ -1,13 +1,12 @@
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", type: "nfs" config.vm.box = "bento/debian-12"
config.vm.box = "debian/buster64"
config.vm.define "cchauvetS" do |server| config.vm.define "cchauvetS" do |server|
server.vm.hostname = "cchauvetS" server.vm.hostname = "cchauvetS"
server.vm.network "private_network", :ip => "192.168.56.110" server.vm.network "private_network", :ip => "192.168.56.110"
server.vm.provider "libvirt" do |lv| server.vm.provider "virtualbox" do |vb|
lv.cpus = "8" vb.cpus = "2"
lv.memory = "10240" vb.memory = "2048"
end end
server.vm.provision "shell", path: "scripts/k3s.sh" server.vm.provision "shell", path: "scripts/k3s.sh"
end end

View File

@ -16,3 +16,5 @@ spec:
automated: automated:
selfHeal: true selfHeal: true
prune: true prune: true
syncOptions:
- CreateNamespace=true

View File

@ -1 +0,0 @@
kubectl port-forward svc/argocd-server -n argocd 8080:443 &

View File

@ -1,4 +0,0 @@
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
ARGOCD_PWD=$(argocd admin initial-password -n argocd | head -n1)
argocd login localhost:8080 --username=admin --password=$ARGOCD_PWD
argocd account update-password --current-password $ARGOCD_PWD --new-password="root1234"

View File

@ -1,49 +0,0 @@
# !/bin/sh
# install docker
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install ca-certificates curl -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io -y
systemctl enable docker
# install k3d
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
# install kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
#install ArgoCD
curl -sSL -o argocd-linux-amd64 https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64
install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
k3d cluster create part3 --agents 1
# Install ARGOCD on k3d
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Install playground
kubectl create namespace dev
kubectl apply -n argocd -f ./confs/argocd.yaml
# Change argo password
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
ARGOCD_PWD=$(argocd admin initial-password -n argocd | head -n1)
argocd login localhost:8080 --username=admin --password=$ARGOCD_PWD
argocd account update-password --current-password $ARGOCD_PWD --new-password="root1234"

View File

@ -0,0 +1 @@
kubectl -n argocd get secrets argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d

14
p3/scripts/install.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/env bash
# Install dependancies
command -v docker >/dev/null || sudo pacman -S docker
command -v kubectl >/dev/null || sudo pacman -S kubectl
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
k3d cluster create
# Install ArgoCD
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl apply -n argocd -f ./confs/argocd.yaml

View File

@ -0,0 +1 @@
kubectl port-forward svc/argocd-server -n argocd 8080:443