summaryrefslogtreecommitdiff
path: root/playbooks.d/k3s-master/playbook.bash
blob: b0b39ad70fb2a52a4f0c4123e2ae3e30bbf39a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash

playbook_add() {
	pkg install helm k3s

	info "$BASHTARD_PLAYBOOK" "Writing config.yaml for k3s"
	mkdir -pv -- /etc/rancher/k3s
	cat <<-EOF > /etc/rancher/k3s/config.yaml
	node-name: ${BASHTARD_PLATFORM[fqdn]}
	node-ip: $(config "k3s.network.ip" "$(config "vpn.ipv4" "127.0.0.1")")
	bind-address: $(config "k3s.network.bind" "$(config "vpn.ipv4" "0.0.0.0")")
	cluster-cidr: $(config "k3s.network.cidr.pods")
	service-cidr: $(config "k3s.network.cidr.svcs")
	cluster-dns: $(config "k3s.network.service.dns")
	cluster-domain: $(config "k3s.domain")
	disable:
	- traefik
	EOF

	info "$BASHTARD_PLAYBOOK" "Installing k3s"
	curl -sfL https://get.k3s.io | sh -  # I hate this

	export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
	export HELM_KUBECONTEXT=default

	info "$BASHTARD_PLAYBOOK" "Setting up Helm repositories"
	helm repo add nginx-stable https://helm.nginx.com/stable
	helm repo update

	info "$BASHTARD_PLAYBOOK" "Installing ArgoCD on k3s"
	k3s kubectl create namespace argocd
	k3s kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

	info "$BASHTARD_PLAYBOOK" "Installing Nginx Ingress Controller to k3s"
	k3s kubectl create namespace ingress
	helm install ingress-nginx -n ingress nginx-stable/nginx-ingress
}

playbook_sync() {
	#k3s kubectl apply -Rf "$BASHTARD_ETCDIR/playbooks.d/$BASHTARD_PLAYBOOK/share"
	:
}

playbook_del() {
	/usr/local/bin/k3s-uninstall.sh
}