Skip to content

Commit

Permalink
chore: Upgrade dependencies & fix server SKUs (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
tibordp authored Sep 22, 2024
1 parent 039c0e1 commit f00c381
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 43 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,20 @@ and check the access by viewing the created cluster nodes:
```cmd
$ kubectl get nodes --kubeconfig=kubeconfig.conf
NAME STATUS ROLES AGE VERSION
k8s-control-plane-0 Ready control-plane 31m v1.29.2
k8s-worker-0 Ready <none> 31m v1.29.2
k8s-worker-1 Ready <none> 31m v1.29.2
k8s-control-plane-0 Ready control-plane 31m v1.31.1
k8s-worker-0 Ready <none> 31m v1.31.1
k8s-worker-1 Ready <none> 31m v1.31.1
```

## Supported base images

The module should work on most major RPM and DEB distros. It been tested on these base images:

- Ubuntu 22.04 (`ubuntu-22.04`)
- Ubuntu 24.04 (`ubuntu-24.04`)
- Debian 12 (`debian-12`)
- Centos Stream 9 (`centos-stream-9`)
- Rocky Linux 9 (`rocky-9`)
- Fedora 38 (`fedora-38`)
- Fedora 39 (`fedora-39`)
- Fedora 40 (`fedora-40`)

Others may work as well, but have not been tested.

Expand Down
4 changes: 2 additions & 2 deletions examples/cloud_init.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module "cluster" {
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = vars.hetzner_token
location = "hel1"
server_type = "cx31"
server_type = "cpx31"
}

// After control plane is set up, additional workers can be joined
Expand All @@ -37,7 +37,7 @@ resource "hcloud_server" "instance" {
ssh_keys = [hcloud_ssh_key.key.id]
image = "ubuntu-20.04"
location = "hel1"
server_type = "cx31"
server_type = "cpx31"

user_data = module.cluster.join_user_data
}
Expand Down
4 changes: 2 additions & 2 deletions examples/private_network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module "cluster" {
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = vars.hetzner_token
location = "hel1"
server_type = "cx31"
server_type = "cpx31"

# The default pod_cidr_ipv6 is 10.96.0.0/16. This can be customized,
# but it should be within the range of the private network. Also, it should
Expand All @@ -49,7 +49,7 @@ module "workers" {
hcloud_ssh_key = hcloud_ssh_key.key.id
location = "hel1"

server_type = "cx31"
server_type = "cpx31"

use_hcloud_network = true
hcloud_network_id = hcloud_network.my_net.id
Expand Down
4 changes: 2 additions & 2 deletions examples/simple.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module "cluster" {
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = vars.hetzner_token
location = "hel1"
server_type = "cx31"
server_type = "cpx31"
}

module "workers" {
Expand All @@ -40,7 +40,7 @@ module "workers" {
hcloud_ssh_key = hcloud_ssh_key.key.id
location = "hel1"

server_type = "cx31"
server_type = "cpx31"
}

output "simple_kubeconfig" {
Expand Down
6 changes: 1 addition & 5 deletions modules/kubernetes-node/scripts/prepare-node.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ install_kubernetes() {
apt-get -qq install kubelet=${kubernetes_version}-* kubeadm=${kubernetes_version}-* kubectl=${kubernetes_version}-*
apt-mark hold kubelet kubeadm kubectl

mkdir -p /etc/systemd/system/kubelet.service.d
cat <<-EOF > /etc/systemd/system/kubelet.service.d/20-hcloud.conf
[Service]
Environment="KUBELET_EXTRA_ARGS=--cloud-provider=external --node-ip=::"
EOF
echo 'KUBELET_EXTRA_ARGS=--cloud-provider=external --node-ip=::' > /etc/default/kubelet

systemctl daemon-reload
systemctl restart containerd kubelet
Expand Down
10 changes: 5 additions & 5 deletions modules/worker-node/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ variable "hcloud_ssh_key" {
}

variable "server_type" {
description = "Server SKU (default: 'cx31')"
description = "Server SKU (default: 'cpx31')"
type = string
default = "cx31"
default = "cpx31"
}

variable "image" {
description = "Image for the nodes (default: ubuntu-22.04)"
description = "Image for the nodes (default: ubuntu-24.04)"
type = string
default = "ubuntu-22.04"
default = "ubuntu-24.04"
}

variable "location" {
Expand Down Expand Up @@ -51,7 +51,7 @@ variable "labels" {
variable "kubernetes_version" {
description = "Kubernetes version"
type = string
default = "1.29.2"
default = "1.31.1"

validation {
condition = can(regex("^1\\.([0-9]+)\\.([0-9]+)$", var.kubernetes_version))
Expand Down
2 changes: 1 addition & 1 deletion templates/hetzner_ccm.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ spec:
%{ endif ~}
- name: HCLOUD_INSTANCES_ADDRESS_FAMILY
value: dualstack
image: hetznercloud/hcloud-cloud-controller-manager:v1.19.0 # x-release-please-version
image: docker.io/hetznercloud/hcloud-cloud-controller-manager:v1.20.0 # x-release-please-version
ports:
- name: metrics
containerPort: 8233
Expand Down
16 changes: 8 additions & 8 deletions templates/hetzner_csi.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ spec:
initContainers:
containers:
- name: csi-node-driver-registrar
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.7.0
image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.11.1
imagePullPolicy: IfNotPresent
args:
- --kubelet-registration-path=/var/lib/kubelet/plugins/csi.hetzner.cloud/socket
Expand All @@ -199,7 +199,7 @@ spec:
limits: {}
requests: {}
- name: liveness-probe
image: registry.k8s.io/sig-storage/livenessprobe:v2.9.0
image: registry.k8s.io/sig-storage/livenessprobe:v2.13.1
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /run/csi
Expand All @@ -208,7 +208,7 @@ spec:
limits: {}
requests: {}
- name: hcloud-csi-driver
image: docker.io/hetznercloud/hcloud-csi-driver:v2.6.0 # x-release-please-version
image: docker.io/hetznercloud/hcloud-csi-driver:v2.9.0 # x-release-please-version
imagePullPolicy: IfNotPresent
command: [/bin/hcloud-csi-driver-node]
volumeMounts:
Expand Down Expand Up @@ -297,7 +297,7 @@ spec:
initContainers:
containers:
- name: csi-attacher
image: registry.k8s.io/sig-storage/csi-attacher:v4.1.0
image: registry.k8s.io/sig-storage/csi-attacher:v4.6.1
imagePullPolicy: IfNotPresent
resources:
limits: {}
Expand All @@ -309,7 +309,7 @@ spec:
mountPath: /run/csi

- name: csi-resizer
image: registry.k8s.io/sig-storage/csi-resizer:v1.7.0
image: registry.k8s.io/sig-storage/csi-resizer:v1.11.2
imagePullPolicy: IfNotPresent
resources:
limits: {}
Expand All @@ -319,7 +319,7 @@ spec:
mountPath: /run/csi

- name: csi-provisioner
image: registry.k8s.io/sig-storage/csi-provisioner:v3.4.0
image: registry.k8s.io/sig-storage/csi-provisioner:v5.0.2
imagePullPolicy: IfNotPresent
resources:
limits: {}
Expand All @@ -332,7 +332,7 @@ spec:
mountPath: /run/csi

- name: liveness-probe
image: registry.k8s.io/sig-storage/livenessprobe:v2.9.0
image: registry.k8s.io/sig-storage/livenessprobe:v2.13.1
imagePullPolicy: IfNotPresent
resources:
limits: {}
Expand All @@ -342,7 +342,7 @@ spec:
name: socket-dir

- name: hcloud-csi-driver
image: docker.io/hetznercloud/hcloud-csi-driver:v2.6.0 # x-release-please-version
image: docker.io/hetznercloud/hcloud-csi-driver:v2.9.0 # x-release-please-version
imagePullPolicy: IfNotPresent
command: [/bin/hcloud-csi-driver-controller]
env:
Expand Down
4 changes: 2 additions & 2 deletions templates/kubeadm.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ apiVersion: kubelet.config.k8s.io/v1beta1
cgroupDriver: systemd
---
kind: InitConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
apiVersion: kubeadm.k8s.io/v1beta4
certificateKey: "${certificate_key}"
localAPIEndpoint:
advertiseAddress: "${advertise_address}"
bindPort: 6443
---
kind: ClusterConfiguration
apiVersion: kubeadm.k8s.io/v1beta3
apiVersion: kubeadm.k8s.io/v1beta4
kubernetesVersion: "v${kubernetes_version}"
apiServer:
certSANs:
Expand Down
8 changes: 4 additions & 4 deletions test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module "simple_cluster" {
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = var.hetzner_token
location = "hel1"
server_type = "cx21"
server_type = "cpx21"
}

module "simple_worker_node" {
Expand All @@ -38,7 +38,7 @@ module "simple_worker_node" {
hcloud_ssh_key = hcloud_ssh_key.key.id
location = "hel1"

server_type = "cx21"
server_type = "cpx21"
}

module "ha_cluster" {
Expand All @@ -48,7 +48,7 @@ module "ha_cluster" {
hcloud_ssh_key = hcloud_ssh_key.key.id
hcloud_token = var.hetzner_token
location = "hel1"
server_type = "cx21"
server_type = "cpx21"

load_balancer_type = "lb11"

Expand All @@ -64,7 +64,7 @@ module "ha_worker_node" {
hcloud_ssh_key = hcloud_ssh_key.key.id
location = "hel1"

server_type = "cx21"
server_type = "cpx21"
}


Expand Down
12 changes: 6 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ variable "hcloud_ssh_key" {
}

variable "server_type" {
description = "Server SKU for control plane nodes (default: 'cx31')"
description = "Server SKU for control plane nodes (default: 'cpx31')"
type = string
default = "cx31"
default = "cpx31"
}

variable "hcloud_token" {
Expand Down Expand Up @@ -57,9 +57,9 @@ variable "service_cidr_ipv4" {
}

variable "image" {
description = "Image for the nodes (default: ubuntu-22.04)"
description = "Image for the nodes (default: ubuntu-24.04)"
type = string
default = "ubuntu-22.04"
default = "ubuntu-24.04"
}

variable "location" {
Expand Down Expand Up @@ -116,9 +116,9 @@ variable "primary_ip_family" {
}

variable "kubernetes_version" {
description = "Version of Kubernetes to install (default: 1.29.2)"
description = "Version of Kubernetes to install (default: 1.31.1)"
type = string
default = "1.29.2"
default = "1.31.1"

validation {
condition = can(regex("^1\\.([0-9]+)\\.([0-9]+)$", var.kubernetes_version))
Expand Down

0 comments on commit f00c381

Please sign in to comment.