Skip to content

Commit 46d8f7d

Browse files
committed
feat: improve readme
1 parent 251e020 commit 46d8f7d

File tree

3 files changed

+32
-95
lines changed

3 files changed

+32
-95
lines changed

README.md

Lines changed: 23 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ defaults for running production workload.
2121
- configure Openstack Swift or S3-like backend for automated etcd snapshots
2222
- smooth updates & agent nodes autoremoval with pod draining
2323
- bundled with Openstack Cloud Controller and Cinder CSI
24-
- Cilium networking (network policy support and no Kube-proxy)
24+
- Cilium networking (network policy support and no kube-proxy)
2525
- highly-available through load balancers
2626
- out of the box support for volume snapshot and Velero
2727

@@ -38,89 +38,44 @@ defaults for running production workload.
3838
## Getting started
3939

4040
```bash
41-
cat <<EOF > cluster.tf
42-
provider "openstack" {
43-
tenant_name = "PCP-XXXXXXX"
44-
user_name = "PCU-XXXXXXX"
45-
password = "XXXXXXXXXXX"
46-
auth_url = "https://api.pub1.infomaniak.cloud/identity"
47-
region = "dc3-a"
48-
}
49-
50-
module "rke2" {
51-
source = "zifeo/rke2/openstack"
52-
53-
name = "k8s"
54-
55-
floating_pool = "ext-floating1"
56-
rules_ssh_cidr = "0.0.0.0/0"
57-
rules_k8s_cidr = "0.0.0.0/0"
58-
59-
bootstrap = true
60-
servers = [
61-
{
62-
name = "server-a"
63-
64-
flavor_name = "a2-ram4-disk0"
65-
image_name = "Ubuntu 20.04 LTS Focal Fossa"
66-
system_user = "ubuntu"
67-
boot_volume_size = 8
68-
69-
rke2_version = "v1.25.3+rke2r1"
70-
rke2_volume_size = 16
71-
}
72-
]
73-
74-
agents = [
75-
{
76-
name = "pool-a"
77-
nodes_count = 1
78-
79-
flavor_name = "a2-ram4-disk0"
80-
image_name = "Ubuntu 20.04 LTS Focal Fossa"
81-
system_user = "ubuntu"
82-
boot_volume_size = 8
83-
84-
rke2_version = "v1.25.3+rke2r1"
85-
rke2_volume_size = 16
86-
}
87-
]
88-
}
89-
90-
terraform {
91-
required_providers {
92-
openstack = {
93-
source = "terraform-provider-openstack/openstack"
94-
}
95-
}
96-
}
41+
git clone [email protected]:zifeo/terraform-openstack-rke2.git && cd terraform-openstack-rke2/examples/single-server
42+
cat <<EOF > terraform.tfvars
43+
project=PCP-XXXXXXXX
44+
username=PCU-XXXXXXXX
45+
password=XXXXXXXX
9746
EOF
9847

9948
terraform init
100-
terraform apply
101-
# or, on upgrade, to process node by node
49+
terraform apply # approx 2-3 mins
50+
kubectl --kubeconfig single-server.rke2.yaml get nodes
51+
# NAME STATUS ROLES AGE VERSION
52+
# k8s-pool-a-1 Ready <none> 119s v1.21.5+rke2r2
53+
# k8s-server-1 Ready control-plane,etcd,master 2m22s v1.21.5+rke2r2
54+
55+
# on upgrade, process node pool by node pool
10256
terraform apply -target='module.rke2.module.servers["server-a"]'
10357
# for servers, apply on the majority of nodes, then for the remaining ones
10458
# this ensures the load balancer routes are updated as well
10559
terraform apply -target='module.rke2.openstack_lb_members_v2.k8s'
10660
```
10761

108-
See [examples](./examples) for more options.
62+
See [examples](./examples) for more options or this
63+
[article](https://zifeo.com/articles/230617-low-cost-k8s) for a step-by-step
64+
tutorial.
10965

11066
Note: it requires [rsync](https://rsync.samba.org) and
111-
[yq](https://github.com/mikefarah/yq) to generate remote kube config file. You
112-
can disable this behaviour by setting `ff_write_kubeconfig=false` and fetch
67+
[yq](https://github.com/mikefarah/yq) to generate remote kubeconfig file. You
68+
can disable this behavior by setting `ff_write_kubeconfig=false` and fetch
11369
yourself `/etc/rancher/rke2/rke2.yaml` on server nodes.
11470

11571
## Infomaniak OpenStack
11672

117-
A stable, performent and fully-equiped Kubernetes cluster in Switzerland for as
73+
A stable, performant and fully equipped Kubernetes cluster in Switzerland for as
11874
little as CHF 26.90/month (at the time of writing):
11975

120-
- nginx-ingress with floating ip (perfect under Cloudflare proxy)
121-
- persistence through cinder-csi storage classes (retain, delete)
122-
- 1 server 1cpu/2go (= master)
123-
- 1 agent 1cpu/2go (= worker)
76+
- load-balancer with floating IP (perfect under Cloudflare proxy)
77+
- 1 server 2cpu/4Go (= master)
78+
- 1 agent 2cpu/4Go (= worker)
12479

12580
| Flavour | CHF/month |
12681
| ---------------------------------------------------------------------------------- | --------- |
@@ -129,34 +84,12 @@ little as CHF 26.90/month (at the time of writing):
12984
| 3x2cpu/4go HA servers with 1x4cpu/16Go worker | ~50.— |
13085
| 3x2cpu/4go HA servers with 3x4cpu/16Go workers | ~85.— |
13186

132-
```bash
133-
git clone [email protected]:zifeo/terraform-openstack-rke2.git && cd terraform-openstack-rke2/examples/single-server
134-
cat <<EOF > terraform.tfvars
135-
tenant_name = "PCP-XXXXXXX"
136-
user_name = "PCU-XXXXXXX"
137-
password = "XXXXXXXXXXX"
138-
EOF
139-
terraform init
140-
terraform apply # approx 2-3mins
141-
kubectl --kubeconfig rke2.yaml get nodes
142-
# NAME STATUS ROLES AGE VERSION
143-
# k8s-pool-a-1 Ready <none> 119s v1.21.5+rke2r2
144-
# k8s-server-1 Ready control-plane,etcd,master 2m22s v1.21.5+rke2r2
145-
helm install wordpress --values wordpress.yaml --namespace default bitnami/wordpress
146-
kubectl --kubeconfig rke2.yaml get pods -n default
147-
# NAME READY STATUS RESTARTS AGE
148-
# wordpress-7474ddb77f-w6c86 1/1 Running 0 102s
149-
# wordpress-mariadb-0 1/1 Running 0 102s
150-
curl -s $(terraform output -raw floating_ip) -H 'host: wordpress.local' | grep Welcome
151-
# <p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>
152-
```
153-
15487
See their technical [documentation](https://docs.infomaniak.cloud) and
15588
[pricing](https://www.infomaniak.com/fr/hebergement/public-cloud/tarifs).
15689

15790
## More on RKE2 & OpenStack
15891

159-
[RKE2 cheatsheet](https://gist.github.com/superseb/3b78f47989e0dbc1295486c186e944bf)
92+
[RKE2 cheat sheet](https://gist.github.com/superseb/3b78f47989e0dbc1295486c186e944bf)
16093

16194
```
16295
# alias already set on the nodes

examples/lade.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
terraform:
2+
TF_VAR_username: "op://exponent.1password.eu/Private/Openstack%20teo-debug/username"
3+
TF_VAR_password: "op://exponent.1password.eu/Private/Openstack%20teo-debug/password"
4+
TF_VAR_project: "op://exponent.1password.eu/Private/Openstack%20teo-debug/project"

examples/single-server/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module "rke2" {
33
# version = ""
44
source = "./../.."
55

6-
# must be true for single-server cluster or only on the first run for HA cluster
6+
# must be true for single server cluster or
7+
# only on the first run for high-availability cluster
78
bootstrap = true
89
name = "single-server"
910
ssh_authorized_keys = ["~/.ssh/id_rsa.pub"]
@@ -24,9 +25,8 @@ module "rke2" {
2425

2526
rke2_version = "v1.26.4+rke2r1"
2627
rke2_volume_size = 6
27-
rke2_config = <<EOF
28-
# https://docs.rke2.io/install/install_options/server_config/
29-
28+
# https://docs.rke2.io/install/install_options/server_config/
29+
rke2_config = <<EOF
3030
etcd-snapshot-schedule-cron: "0 */6 * * *"
3131
etcd-snapshot-retention: 20
3232
@@ -49,7 +49,7 @@ control-plane-resource-requests: kube-apiserver-cpu=75m,kube-apiserver-memory=12
4949
}
5050
]
5151

52-
# enable automatically `kubectl delete node AGENT-NAME` after an agent change
52+
# enable automatically agent removal of the cluster
5353
ff_autoremove_agent = true
5454
# rewrite kubeconfig
5555
ff_write_kubeconfig = true

0 commit comments

Comments
 (0)