Skip to content

Commit 28b5b46

Browse files
authored
v0.0.2 - migrated from template selector to template tag & added helm chart (#9)
* Highlight no SSH access requirement in PKE * polish for release * migrate from templateID to templateSelector * added cluster helm-chart
1 parent 8a60319 commit 28b5b46

File tree

14 files changed

+169
-37
lines changed

14 files changed

+169
-37
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v2
2+
description: A Helm chart for Proxmox Kubernetes Cluster deployment within the Proxmox Kubernetes Engine (PKE)
3+
type: application
4+
name: proxmox-kubernetes-cluster
5+
version: 0.0.1
6+
appVersion: "1.34.2"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
controlPlane:
2+
endpoint: "192.168.2.203"
3+
replicas: 3
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# proxmox-kubernetes-cluster
2+
3+
A Helm chart for deploying a Kubernetes Cluster on Proxmox VE using Proxmox Kubernetes Engine (PKE).
4+
5+
This chart simplifies the deployment of the Cluster object, including configurable versions, node counts, features, and essential networking (Control Plane Endpoint).
6+
7+
## Prerequisites
8+
9+
* Kubernetes (for installing the chart)
10+
* A running instance of the Proxmox Kubernetes Engine
11+
12+
## Installation
13+
14+
To install the chart with the release name `my-proxmox-k8s-cluster`:
15+
16+
```bash
17+
helm install my-proxmox-k8s-cluster proxmox-kubernetes-cluster \
18+
--set controlPlane.endpoint="192.168.1.100" \
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: cluster.x-k8s.io/v1beta2
2+
kind: Cluster
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: caprox-kubernetes-engine
6+
labels:
7+
caprox.eu/cni: cilium-v1.18.4
8+
caprox.eu/ccm: "true"
9+
caprox.eu/inject-proxmox-credentials: "true"
10+
{{- if .Values.features.csi }}
11+
caprox.eu/csi: "true"
12+
{{- end }}
13+
{{- if .Values.features.serviceLb }}
14+
caprox.eu/service-lb: "true"
15+
{{- end }}
16+
spec:
17+
topology:
18+
classRef:
19+
name: proxmox-clusterclass-cilium-v0.1.0
20+
version: {{ .Values.kubernetesVersion | quote }}
21+
controlPlane:
22+
replicas: {{ .Values.controlPlane.replicas }}
23+
workers:
24+
machineDeployments:
25+
- class: proxmox-worker
26+
name: proxmox-worker-pool
27+
replicas: {{ .Values.workers.replicas }}
28+
variables:
29+
- name: cloneSpec
30+
value:
31+
vmTemplate:
32+
templateTag: {{ .Values.kubernetesVersion | quote }}
33+
- name: controlPlaneEndpoint
34+
value:
35+
host: {{ required "Eine gültige IP (controlPlane.endpoint) ist erforderlich!" .Values.controlPlane.endpoint | quote }}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Proxmox Kubernetes Cluster",
4+
"type": "object",
5+
"required": [
6+
"controlPlane"
7+
],
8+
"properties": {
9+
"kubernetesVersion": {
10+
"type": "string",
11+
"title": "Kubernetes Version",
12+
"description": "Die Version von Kubernetes. Setzt gleichzeitig das VM Template Tag.",
13+
"pattern": "^\\d+\\.\\d+\\.\\d+$",
14+
"default": "1.34.2"
15+
},
16+
"controlPlane": {
17+
"type": "object",
18+
"title": "Control Plane Konfiguration",
19+
"required": ["endpoint", "replicas"],
20+
"properties": {
21+
"replicas": {
22+
"type": "integer",
23+
"title": "Anzahl Replikas",
24+
"minimum": 1,
25+
"default": 1
26+
},
27+
"endpoint": {
28+
"type": "string",
29+
"title": "Control Plane IP (Host)",
30+
"description": "Die statische IP-Adresse (VIP) für den Zugriff auf den API-Server (Pflichtfeld).",
31+
"format": "ipv4"
32+
}
33+
}
34+
},
35+
"workers": {
36+
"type": "object",
37+
"title": "Worker Nodes Konfiguration",
38+
"properties": {
39+
"replicas": {
40+
"type": "integer",
41+
"title": "Anzahl Replikas",
42+
"minimum": 0,
43+
"default": 1
44+
}
45+
}
46+
},
47+
"features": {
48+
"type": "object",
49+
"title": "Zusatzfunktionen (Labels)",
50+
"properties": {
51+
"csi": {
52+
"type": "boolean",
53+
"title": "CSI (Storage) aktivieren",
54+
"default": true
55+
},
56+
"serviceLb": {
57+
"type": "boolean",
58+
"title": "Service LoadBalancer aktivieren",
59+
"default": true
60+
}
61+
}
62+
}
63+
}
64+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# values.yaml
2+
kubernetesVersion: "v1.34.2"
3+
4+
controlPlane:
5+
replicas: 1
6+
endpoint: ""
7+
8+
workers:
9+
replicas: 1
10+
11+
features:
12+
csi: true
13+
serviceLb: true

docs/quick-start.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ Please ensure that you have DHCP configured in your network. If you encounter an
169169

170170
If you're lucky, you should see a new template in the UI after a few minutes.![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebymhlsjwkqa2o49bhek.png)
171171

172+
In order for the Cluster API to find our template later, we need to add a tag named `v1.34.2` to the template.
173+
![Tag](https://i.imgur.com/QrPsQxQ.png)
174+
175+
This step will be automated when [this](https://github.com/kubernetes-sigs/image-builder/pull/1914) is merged and released.
176+
172177
And thats it - you completed the "most complicated" part!
173178

174179
## Initialize Cluster-API
@@ -295,7 +300,7 @@ spec:
295300
project: default
296301
source:
297302
repoURL: https://github.com/Caprox-eu/Proxmox-Kubernetes-Engine.git
298-
targetRevision: 08302b9a1e3d3699b2a716ac9e07bc53e9aeabeb
303+
targetRevision: v0.0.2
299304
path: manifests/clusterclass-cilium-with-shared-ippool/base
300305
syncPolicy:
301306
syncOptions:
@@ -395,7 +400,7 @@ stringData:
395400
namespace: kube-system
396401
stringData:
397402
# change this
398-
token_id: "xxx@pve!capi"
403+
token_id: "caprox@pve!capi"
399404
token_secret: "xxx-xxx-xxx-xxx-xxx"
400405
---
401406
apiVersion: v1
@@ -480,7 +485,7 @@ As always everthing is a file - same is true for a Kubernetes Cluster in Cluster
480485
### The Cluster Resource
481486
A cluster configuration which is compatible with our setup could look like this.
482487
```yaml
483-
# cluster.yaml
488+
# configure controlPlaneEndpoint
484489
apiVersion: cluster.x-k8s.io/v1beta1
485490
kind: Cluster
486491
metadata:
@@ -509,8 +514,7 @@ spec:
509514
- name: cloneSpec
510515
value:
511516
vmTemplate:
512-
sourceNode: node01
513-
templateID: 114
517+
templateTag: "v1.34.2"
514518
#Example of if you want to modify node resources
515519
#machineSpec:
516520
# controlPlane:
@@ -527,15 +531,11 @@ spec:
527531
# sizeGb: 80
528532
- name: controlPlaneEndpoint
529533
value:
530-
host: 192.168.2.200
534+
host: 192.168.2.210
531535
```
532536
533537
The fields you **must** change are:
534538
535-
* **`vmTemplate`**
536-
* **`sourceNode`**: Set this to the name of the Proxmox node where your VM template is located.
537-
* **`templateID`**: This is the ID of your Kubernetes template. You can find it in the Proxmox UI, listed as the number next to the template name.
538-
539539
* **`controlPlaneEndpoint`**:
540540
* This IP address will be used to access your Kubernetes cluster.
541541
* Ensure it's outside your defined IP pool range.

manifests/clusterclass-cilium-with-shared-ippool/base/patches/KubeadmConfigTemplate/WorkerNodeSetup.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@
2828
- proxmox-worker
2929
jsonPatches:
3030
- op: replace
31-
path: /spec/template/spec/sourceNode
31+
path: /spec/template/spec/templateSelector/matchTags
32+
# template used because valueFrom with string was not working
3233
valueFrom:
33-
variable: cloneSpec.vmTemplate.sourceNode
34-
- op: replace
35-
path: /spec/template/spec/templateID
36-
valueFrom:
37-
variable: cloneSpec.vmTemplate.templateID
34+
template: |
35+
[ "{{ .cloneSpec.vmTemplate.templateTag }}" ]

manifests/clusterclass-cilium-with-shared-ippool/base/patches/KubeadmControlPlaneTemplate/ControlPlaneSetup.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@
8585
controlPlane: true
8686
jsonPatches:
8787
- op: replace
88-
path: /spec/template/spec/sourceNode
88+
path: /spec/template/spec/templateSelector/matchTags
89+
# template used because valueFrom with string was not working
8990
valueFrom:
90-
variable: cloneSpec.vmTemplate.sourceNode
91-
- op: replace
92-
path: /spec/template/spec/templateID
93-
valueFrom:
94-
variable: cloneSpec.vmTemplate.templateID
91+
template: |
92+
[ "{{ .cloneSpec.vmTemplate.templateTag }}" ]

manifests/clusterclass-cilium-with-shared-ippool/base/templates/proxmox-machine-template-cp.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ metadata:
55
spec:
66
template:
77
spec:
8-
sourceNode: pve1
9-
templateID: 100
8+
templateSelector:
9+
matchTags:
10+
- "v1.34.1"
1011
format: qcow2
1112
full: true
1213
network:

0 commit comments

Comments
 (0)