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

Add how-to for capi in place upgrades #671

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions docs/src/capi/howto/in-place-upgrades.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Perform an in place upgrade for a machine

This guide walks you through the steps to perform an in place upgrade for a
berkayoz marked this conversation as resolved.
Show resolved Hide resolved
Cluster API managed Machine.
evilnick marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisites

To follow this guide, you will need:

- A Kubernetes management cluster with Cluster API and providers installed
and configured.
- A target workload cluster managed by CAPI.
- `kubectl` installed and configured to access your management cluster.
- The workload cluster kubeconfig. We will refer to it as `c1-kubeconfig.yaml`
berkayoz marked this conversation as resolved.
Show resolved Hide resolved
in the following steps.

Please refer to the [getting-started guide][getting-started] for further
details on the required setup.
This guide refers to the workload cluster as `c1` and its
kubeconfig as `c1-kubeconfig.yaml`.

## Check the current cluster status

Prior to the upgrade, ensure that the management cluster is in a healthy
state.

```
kubectl get nodes -o wide
```

Confirm the Kubernetes version of the workload cluster:

```
kubectl --kubeconfig c1-kubeconfig.yaml get nodes -o wide
```

## Annotate the machine

In this first step, annotate the Machine resource with
the in place upgrade annotation. In this example, the machine
is called `c1-control-plane-xyzbw`.

```
kubectl annotate machine c1-control-plane-xyzbw "v1beta2.k8sd.io/in-place-upgrade-to=<upgrade-option>"
```

`<upgrade-option>` can be one of:
* `channel=<snap-channel>` which refreshes k8s to the given snap channel. e.g. `channel=1.30-classic/stable`
* `revision=<revision>` which refreshes k8s to the given revision. e.g. `revision=123`
* `localPath=<path>` which refreshes k8s with the snap file from the given absolute path. `localPath=full/path/to/k8s.snap`

Please refer to the [ClusterAPI Annotations Reference][capi-annotations-reference] for further
details on the options.
berkayoz marked this conversation as resolved.
Show resolved Hide resolved

## Monitor the in place upgrade

Watch the status of the in place upgrade for the machine, by running the
following command and checking the `v1beta2.k8sd.io/in-place-upgrade-status` annotation:

```
kubectl get machine c1-control-plane-xyzbw -o yaml
```

On a successful upgrade:
* Value of the `v1beta2.k8sd.io/in-place-upgrade-status` annotation will be changed to `done`
* Value of the `v1beta2.k8sd.io/in-place-upgrade-release` annotation will be changed to the `<upgrade-option>` used to perform the upgrade.

## Cancelling a failing upgrade
The upgrade is retried periodically if the operation was unsuccessful.

The upgrade can be cancelled by running the following commands that remove the annotations:

```
kubectl annotate machine c1-control-plane-xyzbw "v1beta2.k8sd.io/in-place-upgrade-to-"
kubectl annotate machine c1-control-plane-xyzbw "v1beta2.k8sd.io/in-place-upgrade-change-id-"
```

## Verify the Kubernetes upgrade

Confirm that the node is healthy and runs on the new Kubernetes version:

```
kubectl --kubeconfig c1-kubeconfig.yaml get nodes -o wide
```


<!-- LINKS -->
[getting-started]: ../tutorial/getting-started.md
[capi-annotations-reference]: ../reference/annotations.md
1 change: 1 addition & 0 deletions docs/src/capi/howto/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Overview <self>

external-etcd
rollout-upgrades
in-place-upgrades
upgrade-providers
migrate-management
custom-ck8s
Expand Down
Loading