You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/blog/scale-kubernetes-clusters-using-hpe-greenlake-terraform-provider.md
+26-24Lines changed: 26 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Upgrade Kubernetes Clusters using HPE GreenLake Terraform Provider
3
-
date: 2023-05-15T19:21:37.419Z
2
+
title: Upgrade Kubernetes clusters using HPE GreenLake Terraform Provider
3
+
date: 2023-05-16T15:13:41.342Z
4
4
author: Tanushi Agarwal
5
5
authorimage: /img/photoforblog.jpg
6
6
disable: false
@@ -17,29 +17,29 @@ tags:
17
17
- sre
18
18
- site-reliability-engineer
19
19
---
20
-
IaC or Infrastructure as code is a practice of automating the process of managing and provisioning infrastructure throughcode instead of through manual processes. It gives organizations the tools to create, manage, and destroy compute resources by statically defining and declaring these resources in codeblocks. It helps to increase operational agility, simplify management, reduce errors, and save cost.
20
+
IaC, or Infrastructure as code, is a practice of automating the process of managing and provisioning infrastructure through the use of code instead of using manual processes. It gives organizations the tools required to create, manage, and destroy compute resources by statically defining and declaring these resources in codeblocks. It helps increase operational agility, simplify management, reduce errors, and save cost.
21
21
22
-
In this post, I will explore options to declare and upgrade Kubernetes clusters on HPE GreenLake using the HPE GreenLake Terraform Provider.
22
+
In this post, I will explore options used to declare and upgrade Kubernetes clusters on HPE GreenLake using the HPE GreenLake Terraform Provider.
23
23
24
-
As the part of upgrade, the following 3 scenarios are supported --
24
+
In terms of upgrades, the following 3 scenarios are supported:
25
25
26
26
1. Scaling of a cluster's worker nodes. Please refer to the blog post [Scale Kubernetes Clusters using HPE GreenLake Terraform Provider](https://developer.hpe.com/blog/scale-kubernetes-cluster-using-hpe-greenlake-terraform-provider/) to check out scaling options available for worker nodes.
27
27
2. Upgrade the Kubernetes version of the cluster. This step is covered in this blog.
28
28
3. Upgrade the OS version of the worker nodes inside a cluster. This step is covered in this blog.
29
29
30
30
# Prerequisite
31
31
32
-
Before starting this tutorial, read the blog post [Kubernetes Cluster as Code - Part 1](https://developer.hpe.com/blog/kubernetes-clusters-as-code-part1/), which includes steps for creating a Kubernetes cluster. This post expands upon that scenario by examining how to upgrade a cluster's Kubernetes version & OS version of its worker nodes.
32
+
Before implementing the steps shown in this tutorial, please read the blog post [Kubernetes Cluster as Code - Part 1](https://developer.hpe.com/blog/kubernetes-clusters-as-code-part1/), which includes the steps required to create a Kubernetes cluster. This post expands upon that scenario by examining how to upgrade a cluster's Kubernetes version and the OS version of its worker nodes.
33
33
34
34
# Verify existing Kubernetes cluster
35
35
36
-
After the cluster is created following the instructions found in the [Kubernetes Cluster as Code - Part 1 blog post](https://developer.hpe.com/blog/kubernetes-clusters-as-code-part1/), launch HPE GreenLake Central console and verify that the cluster is present under the appropriate tenant.
36
+
After the cluster is created following the instructions found in the [Kubernetes Cluster as Code - Part 1 blog post](https://developer.hpe.com/blog/kubernetes-clusters-as-code-part1/), launch the HPE GreenLake Central console and verify that the cluster is present under the appropriate tenant.
37
37
38
38
You should see the **tf-test** cluster present under **Dashboard -> Manage your Private Cloud -> Containers**.
Below is the reference Terraform configuration file for the existing cluster.
42
+
Shown below is the reference Terraform configuration file for the existing cluster.
43
43
44
44
```hcl
45
45
terraform {
@@ -82,11 +82,11 @@ resource hpegl_caas_cluster test {
82
82
83
83
For the Kubernetes version upgrade, you need to specify the new version of Kubernetes that is available for upgrade in the resources block.
84
84
85
-
1.**kubernetes_version**: *Use the Kubernetes version that pops up on the cluster details page in the UI.*
85
+
1.**kubernetes_version**: Use the Kubernetes version that pops up on the cluster details page in the UI.
86
86
87
87

88
88
89
-
Below is the reference Terraform configuration for updating the cluster's Kubernetes version.
89
+
Below you can see the reference Terraform configuration for updating the cluster's Kubernetes version.
90
90
91
91
```hcl
92
92
terraform {
@@ -128,7 +128,7 @@ resource hpegl_caas_cluster test {
128
128
129
129
## Run Terraform plan
130
130
131
-
Terraform plan is a dry run that lets you preview the changes that Terraform plans to make to your infrastructure based on the data you provide in your Terraform file. To see this, run **terraform plan**
131
+
Terraform plan is a dry run that lets you preview the changes that Terraform plans to make to your infrastructure based on the data you provide in your Terraform file. To see this, run **terraform plan.**
For an OS version upgrade, you need to specify the new version of the OS image that is available for upgrade & the name of the OS image in the worker node block.
215
+
For an OS version upgrade, you need to specify the new version of the OS image that is available to be upgraded and the name of the OS image in the worker node block.
216
216
217
217
**Note**: The OS version is specific to a worker node pool. All the nodes in the worker node pool will be updated to the same OS version. However, you can have different node pools supporting different OS versions.
218
218
219
-
The worker node block consists of the following fields -
219
+
The worker node block consists of the following fields:
220
220
221
-
1.**name**: *The name of the worker node pool. If you wish to update the default or existing worker node pool, enter the name of that node pool. To create a node pool, specify a new name.*
222
-
2.**machine\_blueprint\_id**: *Fill in the ID for the machine blueprint that is already present in HPE GreenLake Central for your tenant. Use the machine blueprint data source to retrieve the machine blueprint ID.*
223
-
3.**count**: *Add the number of nodes to be present as part of this node pool. We can scale up & down by updating the count value here.*
224
-
4.**os_image**: *The name of the OS image. Use the machine blueprint data source to retrieve the name of OS image.*
225
-
5.**os_version**: *The version to be upgraded to. We can get this version in the UI. Whenever there is a new version available, UI will pop up a banner mentioning the new version.*
221
+
1.**name**: The name of the worker node pool. If you wish to update the default or existing worker node pool, enter the name of that node pool. To create a node pool, specify a new name.
222
+
2.**machine_blueprint_id**: Fill in the ID for the machine blueprint that is already present in HPE GreenLake Central for your tenant. Use the machine blueprint data source to retrieve the machine blueprint ID.
223
+
3.**count**: Add the number of nodes to be present as part of this node pool. We can scale up and down by updating the count value here.
224
+
4.**os_image**: The name of the OS image. Use the machine blueprint data source to retrieve the name of OS image.
225
+
5.**os_version**: The version to be upgraded to. We can get this version in the UI. Whenever there is a new version available, UI will pop up a banner mentioning the new version.
226
226
227
-
We can find the new version by clicking on the **Actions->Update OS** button on the right side of cluster details page.
227
+
You can find the new version by clicking on the **Actions->Update OS** button on the right side of cluster details page.
228
228
229
229

230
230
231
+
Get the name and version of the new image from the card that pops up in the UI and then cancel this action.
232
+
231
233

232
234
233
-
Below is the reference Terraform configuration for updating the OS version of the worker node pool.
235
+
Shown below is the reference Terraform configuration for updating the OS version of the worker node pool.
234
236
235
237
```hcl
236
238
terraform {
@@ -284,7 +286,7 @@ worker_nodes {
284
286
285
287
## Run Terraform plan
286
288
287
-
Again, to preview the changes, do a dry run by running **terraform plan**
289
+
Again, to preview the changes, do a dry run by running **terraform plan.**
288
290
289
291
```shellsession
290
292
$ terraform plan
@@ -384,16 +386,16 @@ hpegl_caas_cluster.test: Modifications complete after 43m18s [id=a32fabb9-7c19-4
**Note**: If you wish to only scale up or down the worker node pool & not update the OS version, add only the 3 fields i.e. **name**, **machine\_blueprint\_id**&**count** in the worker node block.
389
+
**Note**: If you wish to only scale up or down the worker node pool and not update the OS version, add only the 3 fields i.e. **name**, **machine_blueprint_id**and**count** in the worker node block.
388
390
389
391
# Summary
390
392
391
-
In this blog, I covered how to update Kubernetes clusters with Terraform provider for HPE GreenLake. I showed you how to update the Kubernetes version of the cluster & how to upgrade the OS version of worker node pool. Also I discussed how update & upgrade can be performed while scaling a cluster.
393
+
In this blog, I covered how to update Kubernetes clusters with Terraform provider for HPE GreenLake. I showed you how to update the Kubernetes version of the cluster and how to upgrade the OS version of worker node pool. Also I discussed how update and upgrade can be performed while scaling a cluster.
392
394
393
395
I hope you found this information interesting and useful while considering the upgrade of Kubernetes cluster with HPE GreenLake Terraform provider. Use the following links to understand more about Terraform and HPE GreenLake Terraform Provider.
394
396
395
397
*[Learn more about Terraform](https://www.terraform.io/)
396
398
*[Learn more about HPE GreenLake](https://www.hpe.com/us/en/greenlake.html)
397
-
*[Learn more about the HPE GreenLake Terraform provider](https://registry.terraform.io/providers/HPE/hpegl)
399
+
*[Learn more about the HPE GreenLake Terraform provider](https://registry.terraform.io/providers/HPE/hpegl/latest/docs)
398
400
399
401
Don’t forget, you can always find other tutorials and articles on HPE GreenLake on the [HPE Developer blog](https://developer.hpe.com/blog/tag/hpe-greenlake).
0 commit comments