minimumLimaVersion: 2.0.0
base: template:_images/ubuntu-lts
mounts: []
containerd:
system: false
user: false
provision:
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
command -v k0s >/dev/null 2>&1 && exit 0
# install k0s prerequisites
curl -sfL https://get.k0s.sh | sh
- mode: system
script: |
#!/bin/bash
set -eux -o pipefail
# start k0s as a single node cluster
if ! systemctl status k0scontroller >/dev/null 2>&1; then
k0s install controller --single
fi
systemctl start k0scontroller
probes:
- description: "k0s to be running"
script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until sudo test -f /var/lib/k0s/pki/admin.conf; do sleep 3; done"; then
echo >&2 "k0s kubeconfig file has not yet been created"
exit 1
fi
hint: |
The k0s control plane is not ready yet.
Run "limactl shell k0s sudo journalctl -u k0scontroller" to debug.
copyToHost:
- guest: "/var/lib/k0s/pki/admin.conf"
host: "{{.Dir}}/copied-from-guest/kubeconfig.yaml"
deleteOnStop: true
message: |
To run `kubectl` on the host (assumes kubectl is installed), run the following commands:
------
export KUBECONFIG="{{.Dir}}/copied-from-guest/kubeconfig.yaml"
kubectl ...
------