p3: done
This commit is contained in:
		
							
								
								
									
										14
									
								
								p3/Vagrantfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								p3/Vagrantfile
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					Vagrant.configure("2") do |config|
 | 
				
			||||||
 | 
					  config.vm.synced_folder ".", "/vagrant", type: "nfs"
 | 
				
			||||||
 | 
					  config.vm.box = "debian/buster64"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  config.vm.define "cchauvetS" do |server|
 | 
				
			||||||
 | 
					    server.vm.hostname = "cchauvetS"
 | 
				
			||||||
 | 
					    server.vm.network "private_network", :ip => "192.168.56.110"
 | 
				
			||||||
 | 
					    server.vm.provider "libvirt" do |lv|
 | 
				
			||||||
 | 
					      lv.cpus = "4"
 | 
				
			||||||
 | 
					      lv.memory = "4096"
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    server.vm.provision "shell", path: "scripts/cluster.sh"
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
							
								
								
									
										18
									
								
								p3/confs/argocd.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								p3/confs/argocd.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					apiVersion: argoproj.io/v1alpha1
 | 
				
			||||||
 | 
					kind: Application
 | 
				
			||||||
 | 
					metadata:
 | 
				
			||||||
 | 
					  name: playground
 | 
				
			||||||
 | 
					  namespace: argocd
 | 
				
			||||||
 | 
					spec:
 | 
				
			||||||
 | 
					  project: default
 | 
				
			||||||
 | 
					  source:
 | 
				
			||||||
 | 
					    repoURL: https://github.com/starnakin/42_IOT-playground-cchauvet.git
 | 
				
			||||||
 | 
					    targetRevision: HEAD
 | 
				
			||||||
 | 
					    path: .
 | 
				
			||||||
 | 
					  destination:
 | 
				
			||||||
 | 
					    server: https://kubernetes.default.svc
 | 
				
			||||||
 | 
					    namespace: dev
 | 
				
			||||||
 | 
					  syncPolicy:
 | 
				
			||||||
 | 
					    automated:
 | 
				
			||||||
 | 
					      selfHeal: true
 | 
				
			||||||
 | 
					      prune: true
 | 
				
			||||||
							
								
								
									
										49
									
								
								p3/scripts/cluster.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								p3/scripts/cluster.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					# !/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 /vagrant/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"
 | 
				
			||||||
		Reference in New Issue
	
	Block a user