Skip to content

Commit 8c6fe32

Browse files
committed
add lima integration step to doc
Signed-off-by: olalekan odukoya <[email protected]>
1 parent 0d641dd commit 8c6fe32

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

docs/content/setup/integrations.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,96 @@ them to OpenFGA queries.
5959

6060
!!! info "Third Party Solutions"
6161
A third-party example of such a webhook would be Platform Mesh's [rebac-authz-webhook](https://github.com/platform-mesh/rebac-authz-webhook).
62+
63+
## Lima
64+
You can run kcp inside a [Lima](https://github.com/lima-vm/lima)-managed VM, which makes it portable across macOS, Linux, and Windows (via WSL2). This setup gives you a disposable kcp control plane that integrates smoothly with your host kubectl.
65+
66+
1. Create a Lima template for kcp
67+
- Save the following as `kcp.yaml`:
68+
```yaml
69+
minimumLimaVersion: 1.1.0
70+
71+
base: template://_images/ubuntu-lts
72+
73+
mounts: []
74+
75+
containerd:
76+
system: false
77+
user: false
78+
79+
provision:
80+
- mode: system
81+
script: |
82+
#!/bin/bash
83+
set -eux -o pipefail
84+
command -v kcp >/dev/null 2>&1 && exit 0
85+
86+
export DEBIAN_FRONTEND=noninteractive
87+
apt-get update
88+
apt-get install -y curl wget
89+
90+
KCP_VERSION=$(curl -s https://api.github.com/repos/kcp-dev/kcp/releases/latest | grep tag_name | cut -d '"' -f 4)
91+
KCP_VERSION_NO_V=${KCP_VERSION#v}
92+
93+
wget https://github.com/kcp-dev/kcp/releases/download/${KCP_VERSION}/kcp_${KCP_VERSION_NO_V}_linux_arm64.tar.gz
94+
tar -xzf kcp_${KCP_VERSION_NO_V}_linux_arm64.tar.gz
95+
mv bin/kcp /usr/local/bin/
96+
chmod +x /usr/local/bin/kcp
97+
rm -f kcp_${KCP_VERSION_NO_V}_linux_arm64.tar.gz
98+
99+
mkdir -p /var/.kcp/
100+
sudo chmod 755 /var/.kcp
101+
nohup kcp start --root-directory=/var/.kcp/ --bind-address=127.0.0.1 > /var/log/kcp.log 2>&1 &
102+
103+
probes:
104+
- script: |
105+
#!/bin/bash
106+
set -eux -o pipefail
107+
if ! timeout 30s bash -c "until sudo test -f /var/.kcp/admin.kubeconfig; do sleep 3; done"; then
108+
echo >&2 "kcp is not running yet"
109+
exit 1
110+
fi
111+
hint: |
112+
The kcp control plane is not ready yet.
113+
Run "limactl shell kcp sudo journalctl -f" to check system logs.
114+
115+
copyToHost:
116+
- guest: "/var/.kcp/admin.kubeconfig"
117+
host: "{{ '{{.Dir}}' }}/copied-from-guest/kubeconfig.yaml"
118+
deleteOnStop: true
119+
120+
message: |
121+
To run `kubectl` on the host (assumes kubectl is installed), run:
122+
------
123+
export KUBECONFIG="{{ '{{.Dir}}' }}/copied-from-guest/kubeconfig.yaml"
124+
kubectl get workspaces
125+
------
126+
127+
```
128+
2. Initialize the VM
129+
```sh
130+
limactl create --name=kcp ./kcp.yaml
131+
```
132+
133+
3. Start the VM
134+
```sh
135+
limactl start kcp --vm-type=qemu
136+
```
137+
Note: On macOS, Lima may default to vz (Apple Virtualization), while on Linux it defaults to qemu, and on Windows to wsl2. If you want consistency across environments, you can explicitly pass --vm-type=qemu when starting the VM.
138+
139+
4. Export the KCP kubeconfig
140+
```sh
141+
export KUBECONFIG="/Users/<user>/.lima/kcp/copied-from-guest/kubeconfig.yaml"
142+
```
143+
144+
5. Verify API resources
145+
```sh
146+
kubectl api-resources | grep kcp
147+
```
148+
You should see kcp-specific resources such as:
149+
```sh
150+
workspaces ws tenancy.kcp.io/v1alpha1 false Workspace
151+
logicalclusters core.kcp.io/v1alpha1 false LogicalCluster
152+
...
153+
```
154+

0 commit comments

Comments
 (0)