Skip to content

Commit 7649c30

Browse files
authored
Merge pull request #101 from projectsyn/add/k8s-migration
Migrate deprecated k3s to vanilla k8s
2 parents 66be2a0 + 664dceb commit 7649c30

37 files changed

+261
-348
lines changed

class/defaults.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ parameters:
99
charts:
1010
vcluster:
1111
source: https://charts.loft.sh
12-
version: 0.24.1
12+
version: 0.29.1
1313

1414
images:
15-
k3s:
16-
registry: docker.io
17-
image: rancher/k3s
18-
tag: v1.32.9-k3s1
15+
k8s:
16+
registry: ghcr.io
17+
image: loft-sh/kubernetes
18+
tag: v1.32.9
1919
syncer:
2020
registry: ghcr.io
2121
image: loft-sh/vcluster-oss
22-
tag: "0.24.1"
22+
tag: "0.29.1"
2323
oc:
2424
registry: quay.io
2525
image: appuio/oc
@@ -30,8 +30,10 @@ parameters:
3030
size: 5Gi
3131
class_name: null
3232

33-
k3s:
34-
additional_args: []
33+
k8s:
34+
additional_apiserver_args: []
35+
additional_controllermanager_args: []
36+
additional_scheduler_args: []
3537

3638
ingress:
3739
enabled: true
@@ -41,10 +43,10 @@ parameters:
4143

4244
backing_store: {}
4345

44-
additional_manifests: nil
46+
additional_manifests: ""
4547

4648
resources:
47-
k3s:
49+
k8s:
4850
requests:
4951
cpu: 40m
5052
memory: 64Mi
@@ -66,22 +68,28 @@ parameters:
6668
controlPlane:
6769
distro:
6870
k3s:
71+
enabled: false
72+
k8s:
6973
enabled: true
70-
extraArgs: ${vcluster:k3s:additional_args}
74+
apiServer:
75+
extraArgs: ${vcluster:k8s:additional_apiserver_args}
76+
controllerManager:
77+
extraArgs: ${vcluster:k8s:additional_controllermanager_args}
78+
scheduler:
79+
extraArgs: ${vcluster:k8s:additional_scheduler_args}
7180
image:
72-
registry: ${vcluster:images:k3s:registry}
73-
repository: ${vcluster:images:k3s:image}
74-
tag: ${vcluster:images:k3s:tag}
75-
resources: ${vcluster:resources:k3s}
81+
registry: ${vcluster:images:k8s:registry}
82+
repository: ${vcluster:images:k8s:image}
83+
tag: ${vcluster:images:k8s:tag}
84+
resources: ${vcluster:resources:k8s}
7685

7786
statefulSet:
7887
security:
7988
containerSecurityContext:
8089
allowPrivilegeEscalation: false
8190
runAsUser: null
8291
runAsGroup: null
83-
resources:
84-
${vcluster:resources:syncer}
92+
resources: ${vcluster:resources:syncer}
8593
image:
8694
registry: ${vcluster:images:syncer:registry}
8795
repository: ${vcluster:images:syncer:image}

component/scripts/patch-route.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ echo "Check if route is already patched"
1515

1616
patched=$(kubectl -n "$NAMESPACE" get route "$route_name" -o jsonpath='{.spec.tls.destinationCACertificate}')
1717

18-
if [ "$patched" != "" ]; then
18+
if [ "$patched" = "$(cat $cert)" ]; then
1919
echo "Route is already patched. Nothing to do"
2020
exit
2121
fi

component/scripts/synthesize.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ vcluster_kubeconfig=./config
66

77
echo "Setting server URL..."
88

9-
kubectl --kubeconfig "$vcluster_kubeconfig" config set clusters.local.server "$VCLUSTER_SERVER_URL"
9+
kubectl --kubeconfig "$vcluster_kubeconfig" config set clusters.kubernetes.server "$VCLUSTER_SERVER_URL"
1010

1111
echo "Checking for namespace 'syn'..."
1212

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
= Upgrade from 2.x to 3.x
2+
3+
Version 3.x removes the deprecated k3s distro from the configuration.
4+
It is replaced with a vanilla k8s distribution.
5+
The helmchart and vcluster version also get bumped to 0.29.1 to support the new configurations.
6+
7+
[WARNING]
8+
====
9+
Before upgrading to version 3.x, please ensure you have a backup of the vcluster (backingStore PVC).
10+
11+
Migrating from k3s to k8s is automatic and should not need any manual steps.
12+
However if there are issues you can consult https://www.vcluster.com/docs/vcluster/deploy/upgrade/distro-migration#troubleshoot-migration-issues[the official migration docs].
13+
====
14+
15+
== Migrate remove fields
16+
17+
All fields named `k3s` have been renamed to `k8s`.
18+
But unfortunately the configuration is not a drop-in replacement.
19+
20+
The k3s image was an all-in-one kind of deal.
21+
There was only a single `additional_args` parameter that got passed to k3s and those parameters specified if they are for the apiServer or any other component of k8s.
22+
However with the vanilla k8s distribution it's now split across three differenct helm values.
23+
Each with their own `additional_args` setting:
24+
25+
- apiServer: `additional_apiserver_args`
26+
- controllerManager: `additional_controlmanager_args`
27+
- scheduler: `additional_scheduler_args`
28+
29+
[WARNING]
30+
====
31+
The migration supports sqlite and embedded etcd backingStores.
32+
However the embedded etcd backingStores are an enterprise feature.
33+
OSS versions of vcluster with etcd will have a seperately deployed etcd.
34+
Migrations still work, but the certificates will get re-created.
35+
36+
After a migration with etcd kubeconfigs and certificates need to be updated wherever they are referenced.
37+
====
38+
39+
=== Migrating a vcluster with apiServer settings
40+
41+
[source,diff]
42+
----
43+
parameters:
44+
vcluster:
45+
- k3s:
46+
+ k8s:
47+
additional_args:
48+
- - --kube-apiserver-arg=oidc-issuer-url=https://id.local/auth/realms/local
49+
- - --kube-apiserver-arg=oidc-client-id=local
50+
- - --kube-apiserver-arg=oidc-username-claim=email
51+
- - --kube-apiserver-arg=oidc-groups-claim=groups
52+
+ - --oidc-issuer-url=https://id.local/auth/realms/local
53+
+ - --oidc-client-id=local
54+
+ - --oidc-username-claim=email
55+
+ - --oidc-groups-claim=groups
56+
----
57+
58+
[NOTE]
59+
====
60+
The output of `kubectl get nodes` will still show nodes with `v1.32.9+k3s1`.
61+
That's expected.
62+
To check th actual used image use: `kubectl -n $vlcusterns get pods $vclusterpod -oyaml | grep image:`.
63+
====

docs/modules/ROOT/pages/references/parameters.adoc

Lines changed: 48 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Dictionary containing the container images used by this component.
4141

4242
The `kubectl` image is used to create OCP routes. The `kubectl` and `jq` binaries are required in this image.
4343

44-
== `k3s.additional_args`
44+
== `k8s.additional_apiserver_args`
4545

4646
[horizontal]
4747
type:: list
@@ -50,16 +50,47 @@ example::
5050
+
5151
[source,yaml]
5252
----
53-
k3s:
54-
additional_args:
55-
- --kube-apiserver-arg=oidc-issuer-url=https://id.local/auth/realms/local
56-
- --kube-apiserver-arg=oidc-client-id=local
57-
- --kube-apiserver-arg=oidc-username-claim=email
58-
- --kube-apiserver-arg=oidc-groups-claim=groups
53+
k8s:
54+
additional_apiserver_args:
55+
- --oidc-issuer-url=https://id.local/auth/realms/local
56+
- --oidc-client-id=local
57+
- --oidc-username-claim=email
58+
- --oidc-groups-claim=groups
5959
----
6060

61-
Additional arguments for the k3s cluster.
61+
Additional arguments for the k8s apiserver.
6262

63+
== `k8s.additional_controllermanager_args`
64+
65+
[horizontal]
66+
type:: list
67+
default:: `[]`
68+
example::
69+
+
70+
[source,yaml]
71+
----
72+
k8s:
73+
additional_controllermanager_args:
74+
- --arg1=foobar
75+
----
76+
77+
Additional arguments for the k8s controllerManager.
78+
79+
== `k8s.additional_scheduler_args`
80+
81+
[horizontal]
82+
type:: list
83+
default:: `[]`
84+
example::
85+
+
86+
[source,yaml]
87+
----
88+
k8s:
89+
additional_scheduler_args:
90+
- --arg1=foobar
91+
----
92+
93+
Additional arguments for the k8s scheduler.
6394

6495
== `backing_store`
6596

@@ -77,7 +108,7 @@ default::
77108
[source,yaml]
78109
----
79110
resources:
80-
k3s:
111+
k8s:
81112
requests:
82113
cpu: 40m
83114
memory: 64Mi
@@ -92,7 +123,7 @@ resources:
92123
memory: 2Gi
93124
----
94125

95-
The resource requests and limits for the k3s and syncer containers.
126+
The resource requests and limits for the k8s and syncer containers.
96127

97128

98129
== `ingress.host`
@@ -206,7 +237,7 @@ Manifests that should be applied to the vcluster after startup.
206237
[horizontal]
207238
type:: dict
208239

209-
You can override the default helm values here. The default configuration comes with k3s as well as ingress enabled. See defaults.yaml for the exact configuration.
240+
You can override the default helm values here. The default configuration comes with k8s as well as ingress enabled. See defaults.yaml for the exact configuration.
210241

211242

212243
== Example
@@ -215,12 +246,12 @@ You can override the default helm values here. The default configuration comes w
215246
----
216247
ingress:
217248
host: testcluster.local
218-
k3s:
219-
additional_args:
220-
- --kube-apiserver-arg=oidc-issuer-url=https://id.local/auth/realms/local
221-
- --kube-apiserver-arg=oidc-client-id=local
222-
- --kube-apiserver-arg=oidc-username-claim=email
223-
- --kube-apiserver-arg=oidc-groups-claim=groups
249+
k8s:
250+
additional_apiserver_args:
251+
- --oidc-issuer-url=https://id.local/auth/realms/local
252+
- --oidc-client-id=local
253+
- --oidc-username-claim=email
254+
- --oidc-groups-claim=groups
224255
backing_store:
225256
etcd:
226257
deploy:

docs/modules/ROOT/partials/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
.How-to guides
44
* xref:how-tos/upgrade-1.x-to-2.x.adoc[Upgrade 1.x to 2.x]
5+
* xref:how-tos/upgrade-2.x-to-3.x.adoc[Upgrade 2.x to 3.x]
56
* xref:tutorials/installation-openshift.adoc[Installation On OpenShift]
67
* xref:how-tos/oidc.adoc[Setup OIDC Integration]
78

0 commit comments

Comments
 (0)