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
+20-26Lines changed: 20 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,20 +4,21 @@ date: 2023-05-12T04:07:48.888Z
4
4
author: Tanushi Agarwal
5
5
authorimage: /img/photoforblog.jpg
6
6
disable: false
7
+
tags: []
7
8
---
8
-
IaC or Infrastructure as code is an practice of automating the process of managing and provisioning infrastructure through code instead of manual processes. It gives organizations 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.
9
+
IaC or Infrastructure as code is a practice of automating the process of managing and provisioning infrastructure through code 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.
9
10
10
-
> In this post, I will explore options to declare and upgrade Kubernetes clusters on HPE GreenLake using the HPE GreenLake Terraform Provider.
11
+
In this post, I will explore options to declare and upgrade Kubernetes clusters on HPE GreenLake using the HPE GreenLake Terraform Provider.
11
12
12
13
As the part of upgrade, the following 3 scenarios are supported --
13
14
14
-
1. Scaling of a cluster's worker nodes. Please refer 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 woker nodes.
15
-
2. Upgrade the kubernetes version of the cluster. Covered in this blog.
16
-
3. Upgrade the OS version of the worker nodes inside a cluster. Covered in this blog.
15
+
1. Scaling of a cluster's worker nodes. Please refer to the blog post [Scale Kubernetes Clusters using HPE GreenLake Terraform Provider](<1. https://developer.hpe.com/blog/scale-kubernetes-cluster-using-hpe-greenlake-terraform-provider/>)to check out scaling options available for worker nodes.
16
+
2. Upgrade the Kubernetes version of the cluster. This step is covered in this blog.
17
+
3. Upgrade the OS version of the worker nodes inside a cluster. This step is covered in this blog.
17
18
18
19
# Prerequisite
19
20
20
-
Before starting this tutorial, it is recommended that you 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 woker nodes.
21
+
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.
21
22
22
23
# Verify existing Kubernetes cluster
23
24
@@ -66,17 +67,15 @@ resource hpegl_caas_cluster test {
66
67
}
67
68
```
68
69
69
-
# Kubernetes version upgrade
70
+
# Upgrade the Kubernetes version
70
71
71
-
For Kubernetes version upgrade, we need to specify the new version of kubernetes that is available for upgrade in the resources block.
72
+
For the Kubernetes version upgrade, you need to specify the new version of Kubernetes that is available for upgrade in the resources block.
72
73
73
74
1.**kubernetes_version**: *Use the Kubernetes version that pops up on the cluster details page in the UI.*
74
75
75
76

76
77
77
-
78
-
79
-
Below is the reference Terraform configuration for updating the cluster's kubernetes version.
78
+
Below is the reference Terraform configuration for updating the cluster's Kubernetes version.
80
79
81
80
```hcl
82
81
terraform {
@@ -116,7 +115,7 @@ resource hpegl_caas_cluster test {
116
115
}
117
116
```
118
117
119
-
#Ready to Terraform plan
118
+
## Run Terraform plan
120
119
121
120
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**
122
121
@@ -145,7 +144,7 @@ Plan: 0 to add, 1 to change, 0 to destroy.
145
144
Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
146
145
```
147
146
148
-
#Ready to Terraform apply
147
+
## Run Terraform apply
149
148
150
149
Terraform apply executes the actions proposed in the Terraform plan and updates the resources. Run the command **terraform apply** and type **yes** when asked to **Enter a value**.
151
150
@@ -200,28 +199,27 @@ hpegl_caas_cluster.test: Modifications complete after 35m18s [id=a32fabb9-7c19-4
For OS version upgrade, we need to specify the new version of OS Image that is available for upgrade & the name of the OS Image in the worker node block.
202
+
# Upgrade the OS Version
206
203
204
+
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.
207
205
208
206
**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, we can have different node pools supporting different OS versions.
209
207
210
208
The worker node block consist of following fields -
211
209
212
-
1.**name**: *The name of the worker nodepool. If you wish to update default or existing worker node pool, enter the name of that node pool or you can create a new node pool by specifying a new name.*
210
+
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.*
213
211
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.*
214
212
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.*
215
213
4.**os_image**: *The name of the OS image. Use the machine blueprint data source to retrieve the name of OS image.*
216
214
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.*
217
215
218
-
We can find the new version by clicking on the **Actions->Update OS** button on the right side of cluster's details page.
216
+
We can find the new version by clicking on the **Actions->Update OS** button on the right side of cluster details page.
219
217
220
218

221
219
222
220

223
221
224
-
Below is the reference Terraform configuration for updating the worker nodepool's OS version.
222
+
Below is the reference Terraform configuration for updating the OS version of the worker node pool.
225
223
226
224
```hcl
227
225
terraform {
@@ -273,7 +271,7 @@ worker_nodes {
273
271
}
274
272
```
275
273
276
-
#Ready to Terraform plan
274
+
## Run Terraform plan
277
275
278
276
Again, to preview the changes, do a dry run by running **terraform plan**
279
277
@@ -309,7 +307,7 @@ Plan: 0 to add, 1 to change, 0 to destroy.
309
307
Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
310
308
```
311
309
312
-
#Ready to Terraform apply
310
+
## Run Terraform apply
313
311
314
312
Run the command **terraform apply** and type **yes** when asked to **Enter a value**.
315
313
@@ -387,8 +385,4 @@ I hope you found this information interesting and useful while considering the u
387
385
*[Learn more about HPE GreenLake](https://www.hpe.com/us/en/greenlake.html)
388
386
*[Learn more about the HPE GreenLake Terraform provider](https://registry.terraform.io/providers/HPE/hpegl)
389
387
390
-
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).
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