This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rancher_cloud_init.cfg
48 lines (45 loc) · 1.69 KB
/
rancher_cloud_init.cfg
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
47
48
#cloud-config
# vim: syntax=yaml
users:
- name: root
ssh_pwauth: True
chpasswd:
list: |
root:rancher
expire: False
disable_root: false
growpart:
mode: auto
devices: ['/']
runcmd:
# Setup SSH
- cd /root
- rm /etc/ssh/sshd_config
- touch /etc/ssh/sshd_config
- echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
- echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config
- echo "UsePAM yes" >> /etc/ssh/sshd_config
- systemctl restart sshd
# Install k3s
- curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.25.10+k3s1 sh -
- systemctl enable k3s
- systemctl start k3s
# Wait a bit for k3s to initialize
- sleep 60
# Wait a bit more for k3s to be ready
- kubectl wait deployment -n kube-system coredns --for condition=Available=True --timeout=600s
- mkdir /root/.kube
- cp /etc/rancher/k3s/k3s.yaml /root/.kube/config
# Install Helm
- mkdir /root/.cache
- mkdir /root/.config
- curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# Install Rancher
- kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.crds.yaml
- helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
- kubectl create namespace cattle-system
- helm repo add jetstack https://charts.jetstack.io
- helm repo update
- helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.11.0
# Disabling global.cattle.psp is required due to: https://github.com/rancher/rancher/issues/41295
- helm install rancher rancher-latest/rancher --namespace cattle-system --set hostname=rancher.rancher.local --set replicas=1 --set bootstrapPassword=rancher --set global.cattle.psp.enabled=false