github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/installation/upgrade/upgrade-kubeblocks-to-0.6.md (about) 1 --- 2 title: Upgrade to KubeBlocks v0.6 3 description: Upgrade to KubeBlocks, operation, tips and notes 4 keywords: [upgrade, prepull images, feature changes between 0.5 and 0.6] 5 sidebar_position: 1 6 sidebar_label: Upgrade to KubeBlocks v0.6 7 --- 8 9 # Upgrade to KubeBlocks v0.6 10 11 This chapter shows how to upgrade to the KubeBlocks 0.6, including notes and tips. 12 13 ## Before upgrading 14 15 ### Pull images 16 17 KubeBlocks version 0.6 has many image changes from version 0.5. During upgrading, if there are many database instances in the cluster, the instance may be unavailable for a long time if images are pulled at the same time. It is recommended to pull the images required for version 0.6 in advance before upgrading. 18 19 ***Steps*** 20 21 1. Write the following content to a `yaml` file. 22 23 ```bash 24 apiVersion: apps/v1 25 kind: DaemonSet 26 metadata: 27 name: kubeblocks-image-prepuller 28 spec: 29 selector: 30 matchLabels: 31 name: kubeblocks-image-prepuller 32 template: 33 metadata: 34 labels: 35 name: kubeblocks-image-prepuller 36 spec: 37 volumes: 38 - name: shared-volume 39 emptyDir: {} 40 tolerations: 41 - key: "kb-data" 42 operator: "Exists" 43 effect: "NoSchedule" 44 - key: "kb-controller" 45 operator: "Exists" 46 effect: "NoSchedule" 47 initContainers: 48 - name: pull-kb-tools 49 image: registry.cn-hangzhou.aliyuncs.com/apecloud/kubeblocks-tools:0.6.0 50 imagePullPolicy: IfNotPresent 51 command: ["cp", "-r", "/bin/kbcli", "/kb-tools/kbcli"] 52 volumeMounts: 53 - name: shared-volume 54 mountPath: /kb-tools 55 - name: pull-1 56 image: apecloud/kubeblocks-csi-driver:0.1.0 57 imagePullPolicy: IfNotPresent 58 command: ["/kb-tools/kbcli"] 59 volumeMounts: 60 - name: shared-volume 61 mountPath: /kb-tools 62 - name: pull-2 63 image: registry.cn-hangzhou.aliyuncs.com/apecloud/apecloud-mysql-scale:0.1.1 64 imagePullPolicy: IfNotPresent 65 command: ["/kb-tools/kbcli"] 66 volumeMounts: 67 - name: shared-volume 68 mountPath: /kb-tools 69 - name: pull-4 70 image: registry.cn-hangzhou.aliyuncs.com/apecloud/apecloud-mysql-server:8.0.30-5.alpha8.20230523.g3e93ae7.8 71 imagePullPolicy: IfNotPresent 72 command: ["/kb-tools/kbcli"] 73 volumeMounts: 74 - name: shared-volume 75 mountPath: /kb-tools 76 - name: pull-5 77 image: registry.cn-hangzhou.aliyuncs.com/apecloud/apecloud-mysql-server:8.0.30-5.beta1.20230802.g5b589f1.12 78 imagePullPolicy: IfNotPresent 79 command: ["/kb-tools/kbcli"] 80 volumeMounts: 81 - name: shared-volume 82 mountPath: /kb-tools 83 - name: pull-6 84 image: registry.cn-hangzhou.aliyuncs.com/apecloud/kubeblocks-charts:0.6.0 85 imagePullPolicy: IfNotPresent 86 command: ["/kb-tools/kbcli"] 87 volumeMounts: 88 - name: shared-volume 89 mountPath: /kb-tools 90 - name: pull-7 91 image: registry.cn-hangzhou.aliyuncs.com/apecloud/kubeblocks-datascript:0.6.0 92 imagePullPolicy: IfNotPresent 93 command: ["/kb-tools/kbcli"] 94 volumeMounts: 95 - name: shared-volume 96 mountPath: /kb-tools 97 - name: pull-8 98 image: registry.cn-hangzhou.aliyuncs.com/apecloud/kubeblocks-tools:0.6.0 99 imagePullPolicy: IfNotPresent 100 command: ["/kb-tools/kbcli"] 101 volumeMounts: 102 - name: shared-volume 103 mountPath: /kb-tools 104 - name: pull-9 105 image: registry.cn-hangzhou.aliyuncs.com/apecloud/kubeblocks:0.6.0 106 imagePullPolicy: IfNotPresent 107 command: ["/kb-tools/kbcli"] 108 volumeMounts: 109 - name: shared-volume 110 mountPath: /kb-tools 111 - name: pull-10 112 image: registry.cn-hangzhou.aliyuncs.com/apecloud/mongo:5.0.14 113 imagePullPolicy: IfNotPresent 114 command: ["/kb-tools/kbcli"] 115 volumeMounts: 116 - name: shared-volume 117 mountPath: /kb-tools 118 - name: pull-11 119 image: registry.cn-hangzhou.aliyuncs.com/apecloud/mysqld-exporter:0.14.1 120 imagePullPolicy: IfNotPresent 121 command: ["/kb-tools/kbcli"] 122 volumeMounts: 123 - name: shared-volume 124 mountPath: /kb-tools 125 - name: pull-12 126 image: registry.cn-hangzhou.aliyuncs.com/apecloud/pgbouncer:1.19.0 127 imagePullPolicy: IfNotPresent 128 command: ["/kb-tools/kbcli"] 129 volumeMounts: 130 - name: shared-volume 131 mountPath: /kb-tools 132 - name: pull-13 133 image: registry.cn-hangzhou.aliyuncs.com/apecloud/redis-stack-server:7.0.6-RC8 134 imagePullPolicy: IfNotPresent 135 command: ["/kb-tools/kbcli"] 136 volumeMounts: 137 - name: shared-volume 138 mountPath: /kb-tools 139 - name: pull-14 140 image: registry.cn-hangzhou.aliyuncs.com/apecloud/spilo:12.14.0 141 imagePullPolicy: IfNotPresent 142 command: ["/kb-tools/kbcli"] 143 volumeMounts: 144 - name: shared-volume 145 mountPath: /kb-tools 146 - name: pull-15 147 image: registry.cn-hangzhou.aliyuncs.com/apecloud/spilo:12.14.1 148 imagePullPolicy: IfNotPresent 149 command: ["/kb-tools/kbcli"] 150 volumeMounts: 151 - name: shared-volume 152 mountPath: /kb-tools 153 - name: pull-16 154 image: registry.cn-hangzhou.aliyuncs.com/apecloud/spilo:12.15.0 155 imagePullPolicy: IfNotPresent 156 command: ["/kb-tools/kbcli"] 157 volumeMounts: 158 - name: shared-volume 159 mountPath: /kb-tools 160 - name: pull-17 161 image: registry.cn-hangzhou.aliyuncs.com/apecloud/spilo:14.7.2 162 imagePullPolicy: IfNotPresent 163 command: ["/kb-tools/kbcli"] 164 volumeMounts: 165 - name: shared-volume 166 mountPath: /kb-tools 167 - name: pull-18 168 image: registry.cn-hangzhou.aliyuncs.com/apecloud/spilo:14.8.0 169 imagePullPolicy: IfNotPresent 170 command: ["/kb-tools/kbcli"] 171 volumeMounts: 172 - name: shared-volume 173 mountPath: /kb-tools 174 - name: pull-19 175 image: registry.cn-hangzhou.aliyuncs.com/apecloud/wal-g:mongo-latest 176 imagePullPolicy: IfNotPresent 177 command: ["/kb-tools/kbcli"] 178 volumeMounts: 179 - name: shared-volume 180 mountPath: /kb-tools 181 - name: pull-20 182 image: registry.cn-hangzhou.aliyuncs.com/apecloud/wal-g:mysql-latest 183 imagePullPolicy: IfNotPresent 184 command: ["/kb-tools/kbcli"] 185 volumeMounts: 186 - name: shared-volume 187 mountPath: /kb-tools 188 - name: pull-21 189 image: registry.cn-hangzhou.aliyuncs.com/apecloud/agamotto:0.1.2-beta.1 190 imagePullPolicy: IfNotPresent 191 command: ["/kb-tools/kbcli"] 192 volumeMounts: 193 - name: shared-volume 194 mountPath: /kb-tools 195 containers: 196 - name: pause 197 image: k8s.gcr.io/pause:3.2 198 ``` 199 200 2. Apply the `yaml` file to pre-pull images required before upgrading. 201 202 ```bash 203 kubectl apply -f prepull.yaml 204 > 205 daemonset.apps/kubeblocks-image-prepuller created 206 ``` 207 208 3. Check the pulling status. 209 210 ```bash 211 kubectl get pod 212 > 213 NAME READY STATUS RESTARTS AGE 214 kubeblocks-image-prepuller-6l5xr 1/1 Running 0 11m 215 kubeblocks-image-prepuller-7t8t2 1/1 Running 0 11m 216 kubeblocks-image-prepuller-pxbnp 1/1 Running 0 11m 217 ``` 218 219 4. Delete the pod created for pulling image. 220 221 ```bash 222 kubectl delete daemonsets.apps kubeblocks-image-prepuller 223 ``` 224 225 ## Upgrade 226 227 Since version 0.6 of the KubeBlocks DB cluster has many image changes, the Pod will be gradually restarted during the upgrade, resulting in the DB cluster unavailable for a short period of time. The unavailable time of the DB cluster is decided by network conditions and cluster size. The upgrade time of the KubeBlocks controller is about 2 minutes, the unavailable time of a single DB cluster is about 20s to 200s, and the complete recovery time of a single DB cluster is about 20s to 300s. If you pull images before you upgrade, see the section above, the unavailable time of a single DB cluster is about 20s to 100s, and the complete recovery time of a single DB cluster is about 20s to 150s. 228 229 ***Steps*** 230 231 1. Install the new version of `kbcli`. 232 233 ```bash 234 curl -fsSL https://kubeblocks.io/installer/install_cli.sh |bash -s 0.6.0 235 ``` 236 237 2. Upgrade KubeBlocks. 238 239 ```bash 240 kbcli kubeblocks upgrade --version 0.6.0 241 ``` 242 243 ## Feature changes require attention 244 245 ### RABC 246 247 In version 0.6, KubeBlocks automatically manages the RBAC required by the cluster. Added the following 2 cluster roles. 248 - ClusterRole/kubeblocks-cluster-pod-role for pod. 249 - ClusterRole/kubeblocks-volume-protection-pod-role for full disk lock. 250 251 When cluster reconcile is triggered, KubeBlocks creates rolebinding and serviceAccount to bind ClusterRole/kubeblocks-cluster-pod-role. 252 253 You need to create a clusterrolebinding to bind ClusterRole/kubeblocks-volume-protection-pod-role. 254 255 ### Full disk lock 256 257 Kubeblocks version 0.6 adds the disk full lock feature of MySQL, PostGreSQL, and MongoDB databases, which needs to be enabled by modifying the cluster definition. Due to the slight differences in the implementation methods of each database, pay attention to the following instructions: 258 259 - For MySQL database, readwrite account cannot write to the disk when the disk usage reaches the `highwatermark` value, while superuser can still write. 260 - FOr PostGreSQL database and MongoDB, both readwrite user and superruser cannot write when disk usage reaches `highwatermark`. 261 - `90` is the default value setting for highwatermark at the component level which means 90% of disk usage is the threshold, while `85` is used for the volumes setting which will overwrites the component's threshold value. 262 In the cluster definition, add following content to enable full disk lock function. You can set the value according to the real situation. 263 264 ```bash 265 volumeProtectionSpec: 266 highWatermark: 90 267 volumes: 268 - highWatermark: 85 269 name: data 270 ``` 271 272 :::note 273 274 The recommended value of `highWatermark` is 90. 275 276 ::: 277 278 ### Backup and restore 279 280 The backup and restore function of Kubeblocks version 0.6 has been greatly adjusted and upgraded. After the database cluster created in version 0.5 is upgraded to version 0.6, manual adjustment is required, otherwise the new functions of version 0.6 cannot be used. 281 282 | Database | v0.5 | v0.6 | 283 |----------|---------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| 284 | MySQL | Snapshot backup and restore full backup and restore | Snapshot backup and restore <br />Full backup and restore Log file backup <br />PITR based on snapshot <br />PITR based on full data | 285 | PG | Snapshot backup and restore <br />Full backup and restore <br />Log file backup <br />PITR based on snapshot | Snapshot backup and restore <br />Full backup and restore <br />Log file backup <br />PITR based on snapshot | 286 | Redis | Snapshot backup and restore | Snapshot backup and restore <br />Full backup and restore | 287 | Mongo | Full backup and restore | Snapshot backup and restore <br />Full backup and restore Log file backup <br />PITR based on snapshot <br />PITR based on full data | 288 289 ### Password authentication 290 291 The 0.6 version cancels the password-free login capability of the Postgres cluster. Compared with the password-free access of the 0.5 version, the newly created Postgres of 0.6 requires an account password to access. And after you upgrade to 0.6 version, if the cluster remains in` creating` status when restore from a backup, you can check whether there is a password authentication failed error in the pod log of the cluster. This problem can be solved by updating the password. We fix the problem in the next release. 292 Check whether there is a password authentication error. 293 294 ```bash 295 kubectl logs <pod-name> kb-checkrole 296 ... 297 server error (FATAL: password authentication failed for user \"postgres\" (SQLSTATE 28P01))" 298 ... 299 ``` 300 301 Update the password. 302 303 ```bash 304 kubectl exec -it <primary_pod_name> -- bash 305 psql -c "ALTER USER postgres WITH PASSWORD '${PGPASSWORD}';" 306 ```