Skip to content

Commit 11484cb

Browse files
committed
Add example config to deploy kubernetes via k3s
Signed-off-by: Jan Dubois <[email protected]>
1 parent 93f654f commit 11484cb

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

examples/k3s.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Deploy kubernetes via k3s (which installs a bundled containerd).
2+
#
3+
# It can be accessed from the host by exporting the kubeconfig file;
4+
# the ports are already forwarded automatically by lima:
5+
#
6+
# $ export KUBECONFIG=$PWD/kubeconfig.yaml
7+
# $ limactl shell k3s sudo cat /etc/rancher/k3s/k3s.yaml >$KUBECONFIG
8+
# $ kubectl get no
9+
# NAME STATUS ROLES AGE VERSION
10+
# lima-k3s Ready control-plane,master 69s v1.21.1+k3s1
11+
12+
images:
13+
- location: "~/Downloads/hirsute-server-cloudimg-amd64.img"
14+
arch: "x86_64"
15+
16+
mounts: []
17+
18+
ssh:
19+
localPort: 60022
20+
21+
containerd:
22+
system: false
23+
user: false
24+
25+
provision:
26+
- mode: system
27+
script: |
28+
#!/bin/sh
29+
curl -sfL https://get.k3s.io | sh -
30+
31+
probes:
32+
- script: |
33+
#!/bin/bash
34+
set -eux -o pipefail
35+
if ! timeout 30s bash -c "until test -f /etc/rancher/k3s/k3s.yaml; do sleep 3; done"; then
36+
echo >&2 "k3s is not running yet"
37+
exit 1
38+
fi
39+
hint: |
40+
The k3s kubeconfig file has not yet been created.
41+
Run "lima bash sudo journalctl -u k3s" to check the log.
42+
If that is still empty, check the bottom of the log at "/var/log/cloud-init-output.log".

0 commit comments

Comments
 (0)