Skip to content

Commit 5af8e13

Browse files
authored
Add docs for k0s binary upload when using OCI registry (#1279)
Signed-off-by: apedriza <[email protected]>
1 parent 20fd649 commit 5af8e13

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

docs/capi-use-oci-registry.md

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,55 @@ For this setup, you need to use the control plane and bootstrap providers for k0
1313
clusterctl init --control-plane k0sproject-k0smotron --bootstrap k0sproject-k0smotron --infrastructure aws
1414
```
1515

16+
## Uploading the k0s Binary to an OCI Registry
17+
18+
This section would cover how to package and push the k0s binary into an OCI-compatible registry using the [Oras CLI](https://oras.land/docs/).
19+
20+
```bash
21+
# Download the desired k0s binary
22+
curl -L https://github.com/k0sproject/k0s/releases/download/v1.34.1%2Bk0s.0/k0s-v1.34.1+k0s.0-amd64 -o k0s
23+
24+
# Optional: Annotate the layer for your binary
25+
cat <<EOF > annotations.json
26+
{
27+
"k0s": {
28+
"arch": "amd64"
29+
}
30+
}
31+
EOF
32+
33+
# Tag and push it to your OCI registry using Oras
34+
oras push example.com/my-repo/k0s:v1.34.1-k0s.0 k0s --annotation-file annotations.json
35+
```
36+
37+
Once uploaded, you can retrieve the digest associated with the k0s binary blob:
38+
39+
```bash
40+
oras manifest fetch example.com/my-repo/k0s:v1.34.1-k0s.0 | jq
41+
```
42+
43+
This command outputs the OCI manifest, including its layers. One of these layers corresponds to the k0s binary blob.
44+
45+
```json
46+
{
47+
"schemaVersion": 2,
48+
"mediaType": "application/vnd.oci.image.manifest.v1+json",
49+
"artifactType": "application/octet-stream",
50+
"layers": [
51+
{
52+
"mediaType": "application/vnd.oci.image.layer.v1.tar",
53+
"digest": "sha256:abcdefg123456789",
54+
"size": 262022198,
55+
"annotations": {
56+
"org.opencontainers.image.title": "k0s"
57+
}
58+
}
59+
]
60+
}
61+
```
62+
63+
Use the digest of this k0s binary blob later in your `downloadURL` field for the `K0sControlPlane` specification, in this case `sha256:abcdefg123456789` .
64+
1665
## Configure `K0sControlPlane` for using and OCI registry
1766

1867
Configuring the `K0sControlPlane` to pull k0s from an OCI registry is straightforward. **The only requirement is that the machine being bootstrapped needs Oras CLI installed**. You can achieve this in two ways:
@@ -71,7 +120,7 @@ metadata:
71120
name: aws-test
72121
spec:
73122
replicas: 3
74-
version: v1.33.4+k0s.0
123+
version: v1.34.1+k0s.0
75124
updateStrategy: Recreate
76125
k0sConfigSpec:
77126
# OCI URL (digest reference) for the k0s binary blob
@@ -135,7 +184,7 @@ metadata:
135184
name: aws-test
136185
spec:
137186
replicas: 3
138-
version: v1.33.4+k0s.0
187+
version: v1.34.1+k0s.0
139188
updateStrategy: Recreate
140189
k0sConfigSpec:
141190
# OCI URL (digest reference) for the k0s binary blob

0 commit comments

Comments
 (0)