| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | minimumLimaVersion: 2.0.0 |
| 14 | |
| 15 | base: template:_images/ubuntu-lts |
| 16 | |
| 17 | |
| 18 | mounts: [] |
| 19 | |
| 20 | |
| 21 | containerd: |
| 22 | system: false |
| 23 | user: false |
| 24 | |
| 25 | provision: |
| 26 | - mode: system |
| 27 | script: | |
| 28 | #!/bin/bash |
| 29 | set -eux -o pipefail |
| 30 | command -v k0s >/dev/null 2>&1 && exit 0 |
| 31 | |
| 32 | |
| 33 | curl -sfL https://get.k0s.sh | sh |
| 34 | |
| 35 | - mode: system |
| 36 | script: | |
| 37 | #!/bin/bash |
| 38 | set -eux -o pipefail |
| 39 | |
| 40 | |
| 41 | if ! systemctl status k0scontroller >/dev/null 2>&1; then |
| 42 | k0s install controller --single |
| 43 | fi |
| 44 | |
| 45 | systemctl start k0scontroller |
| 46 | |
| 47 | probes: |
| 48 | - description: "k0s to be running" |
| 49 | script: | |
| 50 | #!/bin/bash |
| 51 | set -eux -o pipefail |
| 52 | if ! timeout 30s bash -c "until sudo test -f /var/lib/k0s/pki/admin.conf; do sleep 3; done"; then |
| 53 | echo >&2 "k0s kubeconfig file has not yet been created" |
| 54 | exit 1 |
| 55 | fi |
| 56 | hint: | |
| 57 | The k0s control plane is not ready yet. |
| 58 | Run "limactl shell k0s sudo journalctl -u k0scontroller" to debug. |
| 59 | |
| 60 | copyToHost: |
| 61 | - guest: "/var/lib/k0s/pki/admin.conf" |
| 62 | host: "{{.Dir}}/copied-from-guest/kubeconfig.yaml" |
| 63 | deleteOnStop: true |
| 64 | message: | |
| 65 | To run `kubectl` on the host (assumes kubectl is installed), run the following commands: |
| 66 | ------ |
| 67 | export KUBECONFIG="{{.Dir}}/copied-from-guest/kubeconfig.yaml" |
| 68 | kubectl ... |
| 69 | ------ |