Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(k8s): add a upgrade guide for pools #1280

Merged
merged 6 commits into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/resources/k8s_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,39 @@ Kubernetes pools can be imported using the `{region}/{id}`, e.g.
```bash
$ terraform import scaleway_k8s_pool.mypool fr-par/11111111-1111-1111-1111-111111111111
```

## Changing the node-type of a pool

As your needs evolve, you can migrate your workflow from one pool to another.
Pools have a unique name, and they also have an immutable node type.
Just changing the pool node type will recreate a new pool which could lead to service disruption.
To migrate your application with as little downtime as possible we recommend using the following workflow:

### General workflow to upgrade a pool

- Create a new pool with a different name and the type you target.
- 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.
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/).
- Delete the old pool from your terraform configuration.

### Using a composite name to force creation of a new pool when a variable updates

If you want to have a new pool created when a variable changes, you can use a name derived from node type such as:

```hcl
resource "scaleway_k8s_pool" "kubernetes_cluster_workers_1" {
cluster_id = scaleway_k8s_cluster.kubernetes_cluster.id
name = "${var.kubernetes_cluster_id}_${var.node_type}_1"
node_type = "${var.node_type}"

# use Scaleway built-in cluster autoscaler
autoscaling = true
autohealing = true
size = "5"
min_size = "5"
max_size = "10"
wait_for_pool_ready = true
}
```

Thanks to [@deimosfr](https://github.com/deimosfr) for the contribution.