-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathko-k3s-demos.yaml
84 lines (73 loc) · 2.57 KB
/
ko-k3s-demos.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Deploy kubernetes via k3s (which installs a bundled containerd).
# $ limactl start ./k3s.yaml
# $ limactl shell k3s sudo kubectl
#
# It can be accessed from the host by exporting the kubeconfig file;
# the ports are already forwarded automatically by lima:
#
# $ export KUBECONFIG=$PWD/kubeconfig.yaml
# $ limactl shell k3s sudo cat /etc/rancher/k3s/k3s.yaml >$KUBECONFIG
# $ kubectl get no
# NAME STATUS ROLES AGE VERSION
# lima-k3s Ready control-plane,master 69s v1.21.1+k3s1
#
# This example requires Lima v0.7.0 or later.
env:
CONTAINERD_ADDRESS: /run/k3s/containerd/containerd.sock
K3S_KUBECONFIG_MODE: "644"
INSTALL_K3S_EXEC: "--disable traefik"
images:
- location: https://github.com/lima-vm/alpine-lima/releases/download/v0.2.9/alpine-lima-rd-3.14.3-x86_64.iso
arch: "x86_64"
digest: "sha512:b3892ab70ff3140c7ffaa7ace0eef77b047acf633c00bc375abb867caa618c5bd2d94a71638fae7ef10c462c5d28560bdf7c68d603fa6944767700f08fa54a64"
- location: https://github.com/lima-vm/alpine-lima/releases/download/v0.2.9/alpine-lima-rd-3.14.3-aarch64.iso
arch: "aarch64"
digest: "sha512:416216a86742b5e653375019fc1e4ff57314f75d26a7d170e7680ff896616f1a45e82a0dca81c989492b7c43c624be80a0719a65563ea0359eab57623b01cfbc"
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
# containerd is managed by k3s, not by Lima, so the values are set to false here.
containerd:
system: false
user: false
# CPUs: if you see performance issues, try limiting cpus to 1.
# 🟢 Builtin default: 4
cpus: 1
# Memory size
# 🟢 Builtin default: "4GiB"
memory: "2GiB"
# Disk size
# 🟢 Builtin default: "100GiB"
disk: "50GiB"
provision:
- mode: system
script: |
#!/bin/sh
sudo apk add --update --no-cache curl wget
curl -sfL https://get.k3s.io | sh -
probes:
- script: |
#!/bin/bash
set -eux -o pipefail
if ! timeout 30s bash -c "until test -f /etc/rancher/k3s/k3s.yaml; do sleep 3; done"; then
echo >&2 "k3s is not running yet"
exit 1
fi
hint: |
The k3s kubeconfig file has not yet been created.
Run "limactl shell k3s sudo journalctl -u k3s" to check the log.
If that is still empty, check the bottom of the log at "/var/log/cloud-init-output.log".
portForwards:
# Kube API
- guestIP: 0.0.0.0
guestPort: 6433
hostIP: 0.0.0.0
hostPort: 6433
message: |
To run `kubectl` on the host (assumes kubectl is installed):
----
$ mkdir -p "{{.Dir}}/conf"
$ export KUBECONFIG="{{.Dir}}/conf/kubeconfig.yaml"
$ limactl shell {{.Name}} sudo cat /etc/rancher/k3s/k3s.yaml >$KUBECONFIG
$ kubectl ...