LoginSignup
2
1

More than 1 year has passed since last update.

Rancher upgrede

Last updated at Posted at 2022-10-19

概要&環境

さて、今回はタイトルの通りRancherのバージョンアップをしていきます。
個人で利用している環境だったので、これまではバージョンなんてそこまで気にせず、必要に応じて作り変えてましたが、たまにはやってみようかと思います。

環境は以下の通りです

Rancher: v2.6.4
rke: v1.19.3
OS: ubuntu18.04

Rancher画面で確認できるバージョンです。
image.png

作り替え後は、

Rancher: v2.6.7
rke: v1.19.3
OS: ubuntu18.04

RKEのバージョンもアップしなければな、と思いつつ今回はRancherのみUpgradeします。

手順としては

  1. etcdのスナップショット作成
  2. helmリポジトリのupdate
  3. RancherのUpgrade

etcdのスナップショット取得

まずはetcdのスナップショットを取得します。

rke etcd snapshot-save --name rke-etcd-snapshot-cert

上記コマンドで、RKEが構築されているサーバの/opt/rke/etcd-snapshots配下にrke-etcd-snapshot-cert.zipというファイルが作成されます。

続いて、作成されたファイルをワーキングディレクトリに配置します。

sudo cat /opt/rke/etcd-snapshots/rke-etcd-snapshot-cert.zip > ./rke-etcd-snapshot-cert.zip

helmリポジトリのアップデート

helm repo update
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/ubuntu/.kube/config
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "jetstack" chart repository
...Successfully got an update from the "rancher-stable" chart repository
Update Complete. ⎈Happy Helming!⎈

そしてHelmリポジトリのRancherに関する情報をvalues.yamlに書き込みます。
そのまえに内容を確認してみましょう。

helm list --all-namespaces -f rancher -o yaml
- app_version: v2.6.4
  chart: rancher-2.6.4
  name: rancher
  namespace: cattle-system
  revision: "1"
  status: deployed
  updated: 2022-05-09 01:53:56.181254432 +0000 UTC
- app_version: 1.1.4
  chart: rancher-eks-operator-100.0.3+up1.1.4
  name: rancher-eks-operator
  namespace: cattle-system
  revision: "1"
  status: deployed
  updated: 2022-09-02 07:23:24.563160537 +0000 UTC
- app_version: 1.1.4
  chart: rancher-eks-operator-crd-100.0.3+up1.1.4
  name: rancher-eks-operator-crd
  namespace: cattle-system
  revision: "1"
  status: deployed
  updated: 2022-09-02 07:23:17.161307443 +0000 UTC
- app_version: 0.2.5
  chart: rancher-webhook-1.0.4+up0.2.5
  name: rancher-webhook
  namespace: cattle-system
  revision: "1"
  status: deployed
  updated: 2022-05-09 01:56:36.778904804 +0000 UTC

chartの情報やらなんやらが記載されていますね。
これをvalues.yamlに書き込みます。

helm get values -n cattle-system rancher -o yaml > values.yaml

Rancher Upgrade

ここまできたらUpgradeの準備が完了しました。
以下のコマンドでv2.6.7に変更します。

helm upgrade rancher rancher-stable/rancher \
 --version v2.6.7 \
 --namespace cattle-system \
 --values values.yaml

すると以下のように出力されます。

Release "rancher" has been upgraded. Happy Helming!
NAME: rancher
LAST DEPLOYED: Wed Oct 19 06:55:42 2022
NAMESPACE: cattle-system
STATUS: deployed
REVISION: 2
TEST SUITE: None
NOTES:
Rancher Server has been installed.

NOTE: Rancher may take several minutes to fully initialize. Please standby while Certificates are being issued, Containers are started and the Ingress rule comes up.

Check out our docs at https://rancher.com/docs/

If you provided your own bootstrap password during installation, browse to https://rancher.{IPアドレス}.sslip.io to get started.

If this is the first time you installed Rancher, get started by running this command and clicking the URL it generates:

```
echo https://rancher.{IPアドレス}.sslip.io/dashboard/?setup=$(kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}')
```

To get just the bootstrap password on its own, run:

```
kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{ "\n" }}'
```


Happy Containering!

流石にIPアドレスは隠しましたが、今回実施したコマンドやログをほぼそのまま載せました。
Upgradeの参考になればと思います。

Upgradeをした時の表示にインストール時のように

kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{ "\n" }}'

みたいな記載があり、パスワードも初期化されるのかと思ったのですが、特に変わっておらずこれまで同様のパスで入れました。

ログインした時のバージョン部分を一応スクショしました。
image.png

参考

今回はすっ飛ばしましたけど、念のためにManaged Clusterとかのsnapshotとかも取得するのが安全です。
まぁ個人なので。。。。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1