| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | minimumLimaVersion: 2.0.0 |
| 16 | |
| 17 | base: template:_images/ubuntu-lts |
| 18 | |
| 19 | |
| 20 | mounts: [] |
| 21 | |
| 22 | |
| 23 | containerd: |
| 24 | system: false |
| 25 | user: false |
| 26 | |
| 27 | provision: |
| 28 | - mode: system |
| 29 | script: | |
| 30 | #!/bin/sh |
| 31 | if [ ! -d /var/lib/rancher/rke2 ]; then |
| 32 | curl -sfL https://get.rke2.io | INSTALL_RKE2_CHANNEL=v1.34 sh - |
| 33 | fi |
| 34 | env | grep "http_proxy\|https_proxy\|no_proxy" > /etc/default/rke2-server |
| 35 | sed -i "s/http_proxy/CONTAINERD_HTTP_PROXY/g" /etc/default/rke2-server |
| 36 | sed -i "s/https_proxy/CONTAINERD_HTTPS_PROXY/g" /etc/default/rke2-server |
| 37 | sed -i "s/no_proxy/CONTAINERD_NO_PROXY/g" /etc/default/rke2-server |
| 38 | |
| 39 | systemctl start rke2-server.service |
| 40 | |
| 41 | probes: |
| 42 | - script: | |
| 43 | #!/bin/bash |
| 44 | set -eux -o pipefail |
| 45 | if ! timeout 30s bash -c "until test -f /etc/rancher/rke2/rke2.yaml; do sleep 3; done"; then |
| 46 | echo >&2 "rke2 is not running yet" |
| 47 | exit 1 |
| 48 | fi |
| 49 | hint: | |
| 50 | The rke2 kubeconfig file has not yet been created. |
| 51 | Run "limactl shell rke2 sudo journalctl -u rke2-server" to check the log. |
| 52 | If that is still empty, check the bottom of the log at "/var/log/cloud-init-output.log". |
| 53 | copyToHost: |
| 54 | - guest: "/etc/rancher/rke2/rke2.yaml" |
| 55 | host: "{{.Dir}}/copied-from-guest/kubeconfig.yaml" |
| 56 | deleteOnStop: true |
| 57 | message: | |
| 58 | To run `kubectl` on the host (assumes kubectl is installed), run the following commands: |
| 59 | ------ |
| 60 | export KUBECONFIG="{{.Dir}}/copied-from-guest/kubeconfig.yaml" |
| 61 | kubectl ... |
| 62 | ------ |