-
Notifications
You must be signed in to change notification settings - Fork 4
/
clusterclass-rke2.yaml
219 lines (219 loc) · 6.96 KB
/
clusterclass-rke2.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: rke2
spec:
controlPlane:
ref:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlaneTemplate
name: rke2-control-plane
machineInfrastructure:
ref:
kind: ElementalMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
name: rke2-control-plane
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalClusterTemplate
name: rke2-cluster
workers:
machineDeployments:
- class: rke2-default-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
name: rke2-default-worker-bootstrap
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalMachineTemplate
name: rke2-default-worker
variables:
- name: controlPlaneEndpointHost
required: true
schema:
openAPIV3Schema:
type: string
- name: controlPlaneEndpointPort
required: true
schema:
openAPIV3Schema:
type: integer
default: 6443
- name: vipInterface
required: true
schema:
openAPIV3Schema:
type: string
default: "enp1s0"
- name: k8sVersion
required: true
schema:
openAPIV3Schema:
type: string
patches:
- name: elementalClusterTemplate
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/controlPlaneEndpoint/host"
valueFrom:
variable: controlPlaneEndpointHost
- op: add
path: "/spec/template/spec/controlPlaneEndpoint/port"
valueFrom:
variable: controlPlaneEndpointPort
- name: rKE2ControlPlaneTemplate
definitions:
- selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlaneTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/version"
valueFrom:
variable: k8sVersion
- op: add
path: "/spec/template/spec/files"
valueFrom:
template: |
- content: |
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:
- args:
- manager
env:
- name: vip_arp
value: "true"
- name: port
value: {{ .controlPlaneEndpointPort }}
- name: vip_nodename
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: vip_interface
value: {{ .vipInterface }}
- name: vip_cidr
value: "32"
- name: dns_mode
value: first
- name: cp_enable
value: "true"
- name: cp_namespace
value: kube-system
- name: svc_enable
value: "true"
- name: svc_leasename
value: plndr-svcs-lock
- name: vip_leaderelection
value: "true"
- name: vip_leasename
value: plndr-cp-lock
- name: vip_leaseduration
value: "5"
- name: vip_renewdeadline
value: "3"
- name: vip_retryperiod
value: "1"
- name: address
value: {{ .controlPlaneEndpointHost }}
- name: prometheus_server
value: :2112
image: ghcr.io/kube-vip/kube-vip:v0.8.2
imagePullPolicy: IfNotPresent
name: kube-vip
resources: {}
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
volumeMounts:
- mountPath: /etc/kubernetes/admin.conf
name: kubeconfig
hostAliases:
- hostnames:
- kubernetes
ip: 127.0.0.1
hostNetwork: true
volumes:
- hostPath:
path: /etc/rancher/rke2/rke2.yaml
name: kubeconfig
status: {}
owner: root:root
path: /var/lib/rancher/rke2/server/manifests/kube-vip.yaml
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalClusterTemplate
metadata:
name: rke2-cluster
spec:
template:
spec:
controlPlaneEndpoint:
host: ""
port: 6443
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlaneTemplate
metadata:
name: rke2-control-plane
spec:
template:
spec:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalMachineTemplate
name: rke2-control-plane
serverConfig:
disableComponents:
kubernetesComponents:
- cloudController
nodeDrainTimeout: 2m
registrationMethod: "control-plane-endpoint"
rolloutStrategy:
type: "RollingUpdate"
rollingUpdate:
maxSurge: 1
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalMachineTemplate
metadata:
name: rke2-control-plane
spec:
template:
spec: {}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: RKE2ConfigTemplate
metadata:
name: rke2-default-worker-bootstrap
spec:
template:
spec: {}
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: ElementalMachineTemplate
metadata:
name: rke2-default-worker
spec:
template:
spec: {}