Skip to content

Commit 8b1bb00

Browse files
authored
docs(k8s): add a upgrade guide for pools (#1280)
1 parent ed4a48e commit 8b1bb00

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

docs/resources/k8s_pool.md

+36
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,39 @@ Kubernetes pools can be imported using the `{region}/{id}`, e.g.
104104
```bash
105105
$ terraform import scaleway_k8s_pool.mypool fr-par/11111111-1111-1111-1111-111111111111
106106
```
107+
108+
## Changing the node-type of a pool
109+
110+
As your needs evolve, you can migrate your workflow from one pool to another.
111+
Pools have a unique name, and they also have an immutable node type.
112+
Just changing the pool node type will recreate a new pool which could lead to service disruption.
113+
To migrate your application with as little downtime as possible we recommend using the following workflow:
114+
115+
### General workflow to upgrade a pool
116+
117+
- Create a new pool with a different name and the type you target.
118+
- Use [`kubectl drain`](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#drain) on nodes composing your old pool to drain the remaining workflows of this pool.
119+
Normally it should transfer your workflows to the new pool. Check out the official documentation about [how to safely drain your nodes](https://kubernetes.io/docs/tasks/administer-cluster/safely-drain-node/).
120+
- Delete the old pool from your terraform configuration.
121+
122+
### Using a composite name to force creation of a new pool when a variable updates
123+
124+
If you want to have a new pool created when a variable changes, you can use a name derived from node type such as:
125+
126+
```hcl
127+
resource "scaleway_k8s_pool" "kubernetes_cluster_workers_1" {
128+
cluster_id = scaleway_k8s_cluster.kubernetes_cluster.id
129+
name = "${var.kubernetes_cluster_id}_${var.node_type}_1"
130+
node_type = "${var.node_type}"
131+
132+
# use Scaleway built-in cluster autoscaler
133+
autoscaling = true
134+
autohealing = true
135+
size = "5"
136+
min_size = "5"
137+
max_size = "10"
138+
wait_for_pool_ready = true
139+
}
140+
```
141+
142+
Thanks to [@deimosfr](https://github.com/deimosfr) for the contribution.

0 commit comments

Comments
 (0)