Skip to content

Commit 4119eeb

Browse files
Ping ChenGerrit Code Review
authored andcommitted
Merge "add Envoy Gateway API & Capi K8s autoscaling, remove the Ingress in _kubernetes-advanced"
2 parents ea595b0 + 95c6697 commit 4119eeb

6 files changed

Lines changed: 472 additions & 90 deletions

File tree

_kubernetes-advanced/01-overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ learn the minimum application requirements for a Kubernetes cluster on Nectar.
1010

1111
### What you'll learn
1212

13-
- Build a sample website infrastructure
14-
- Deploy Ingress-Nginx using Helm
13+
- Assign a static IP to Envoy Gateway loadbalancer
1514
- Deploy cert-manager using Helm
15+
- Deploy a kubernetes cluster with autoscaling feature enabled
1616

1717
### What you'll need, a working Kubernetes cluster and Helm application.
1818

_kubernetes-advanced/02-gateway.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Creating an Envoy Gateway with a static IP address
3+
order: 2
4+
duration: 15
5+
---
6+
7+
This section presents the deployment of an Envoy Gateway configured with a static external IP address. The two steps outlined below serve
8+
as a replacement for Step 6 in the [Installing Envoy Gateway]({{ site.baseurl }}/kubernetes/07-envoy-gateway) in Kubernetes tutorial.
9+
Prior to proceeding, users are required to possess adequate privileges to access and operate the Nectar CLI interface.
10+
11+
1. Create a floating IP address via Nectar Openstack CLI interface, the network must be project floating IP network and note down the IP
12+
address for Step 2
13+
14+
```
15+
$ openstack floating ip create <network>
16+
17+
+---------------------+--------------------------------------+
18+
| Field | Value |
19+
+---------------------+--------------------------------------+
20+
| created_at | 2025-05-21T05:30:53Z |
21+
| description | |
22+
| dns_domain | |
23+
| dns_name | |
24+
| fixed_ip_address | None |
25+
| floating_ip_address | 160.250.232.111 |
26+
| ... | |
27+
| updated_at | 2025-05-21T05:30:53Z |
28+
+---------------------+--------------------------------------+
29+
30+
```
31+
32+
2. Create EnvoyProxy and EnvoyGateway, please use the IP address from step 1 for loadBalancerIP.
33+
34+
```
35+
---
36+
apiVersion: gateway.envoyproxy.io/v1alpha1
37+
kind: EnvoyProxy
38+
metadata:
39+
name: proxy
40+
namespace: envoy-gateway-system
41+
spec:
42+
provider:
43+
type: Kubernetes
44+
kubernetes:
45+
envoyService:
46+
loadBalancerIP: 160.250.232.111 # Your static IP created in step 1
47+
---
48+
apiVersion: gateway.networking.k8s.io/v1beta1
49+
kind: Gateway
50+
metadata:
51+
name: httpd-gateway
52+
namespace: envoy-gateway-system
53+
spec:
54+
gatewayClassName: eg
55+
infrastructure:
56+
parametersRef:
57+
group: gateway.envoyproxy.io
58+
kind: EnvoyProxy
59+
name: proxy
60+
listeners:
61+
- name: http
62+
protocol: HTTP
63+
port: 80
64+
allowedRoutes:
65+
namespaces:
66+
from: All# Permits routes from any namespace
67+
68+
```
69+
70+
```
71+
kubectl apply -f gateway.yaml
72+
```
73+
74+
Please continue to Step 7 of the [Installing Envoy Gateway]({{ site.baseurl }}/kubernetes/07-envoy-gateway) guide to complete the tutorial
75+
76+
## More information
77+
78+
For more information, refer to:
79+
80+
- [Envoy Gateway](https://gateway.envoyproxy.io/)

_kubernetes-advanced/02-ingress.md

Lines changed: 0 additions & 85 deletions
This file was deleted.
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
---
2+
title: Deploy a Kubernetes cluster using magnum Capi driver with autoscaling feature
3+
order: 4
4+
duration: 25
5+
---
6+
7+
In this section, we will deploy a kubernetes cluster with autoscaling feature [Cluster Autoscaler](https://cluster-api.sigs.k8s.io/tasks/automated-machine-management/autoscaling).
8+
9+
1. Create a Kubernetes cluster with autoscaling enabled
10+
11+
```
12+
$ openstack coe cluster create --cluster-template \
13+
kubernetes-v1.31.1-ardc-syd-1-v5 --master-count 1 --node-count 1 \
14+
--labels auto_scaling_enabled=true,min_node_count=1,max_node_count=3 \
15+
--keypair <project key> mycluster
16+
Request to create cluster cae2a382-26a5-438d-bbdc-e694249bbede accepted
17+
18+
```
19+
20+
2. Verify status of autoscaling label
21+
22+
```
23+
$ openstack coe cluster show mycluster -c labels_added
24+
+--------------+--------------------------------------------------------------------------------+
25+
| Field | Value |
26+
+--------------+--------------------------------------------------------------------------------+
27+
| labels_added | {'auto_scaling_enabled': 'true', 'min_node_count': '1', 'max_node_count': '3'} |
28+
+--------------+--------------------------------------------------------------------------------+
29+
30+
```
31+
32+
3. Verify whether the cluster creation is successfully created
33+
34+
```
35+
$ openstack coe cluster list
36+
+--------------------------------------+-----------+---------+------------+--------------+--------------------+---------------+
37+
| uuid | name | keypair | node_count | master_count | status | health_status |
38+
+--------------------------------------+-----------+---------+------------+--------------+--------------------+---------------+
39+
| cae2a382-26a5-438d-bbdc-e694249bbede | mycluster | xxxxxx | 1 | 1 | UPDATE_COMPLETE | HEALTHY |
40+
+--------------------------------------+-----------+---------+------------+--------------+--------------------+---------------+
41+
42+
```
43+
44+
4. Download the kubeconfig file and verify the cluster nodes using kubectl in accordance with the [Administering a Cluster]({{ site.baseurl }}/kubernetes/03-administer-cluster) in Kubernetes tutorial
45+
46+
5. Deploy an application - ngnix.yaml
47+
48+
```
49+
apiVersion: apps/v1
50+
kind: Deployment
51+
metadata:
52+
name: nginx-deployment
53+
spec:
54+
selector:
55+
matchLabels:
56+
app: nginx
57+
replicas: 3
58+
template:
59+
metadata:
60+
labels:
61+
app: nginx
62+
spec:
63+
containers:
64+
- name: nginx
65+
image: nginx:1.14.2
66+
ports:
67+
- containerPort: 80
68+
69+
```
70+
71+
```
72+
kubectl apply -f nginx.yaml
73+
```
74+
75+
6. Deploy application and validate the deployment
76+
77+
```
78+
kubectl get deployments
79+
```
80+
81+
```
82+
NAME READY UP-TO-DATE AVAILABLE AGE
83+
nginx-deployment 3/3 3 3 8m44s
84+
$ kubectl get pods
85+
NAME READY STATUS RESTARTS AGE
86+
nginx-deployment-d556bf558-7phtc 1/1 Running 0 9m11s
87+
nginx-deployment-d556bf558-98d68 1/1 Running 0 9m11s
88+
nginx-deployment-d556bf558-shqt2 1/1 Running 0 9m11s
89+
$ kubectl get nodes
90+
NAME STATUS ROLES AGE VERSION
91+
mycluster-l76uten6iljx-control-plane-xlmq4 Ready control-plane 42m v1.31.1
92+
mycluster-l76uten6iljx-default-worker-4dqrj-cwmjq Ready <none> 39m v1.31.1
93+
94+
```
95+
96+
7. Scaling up the nginx application deployment
97+
98+
The number of NGINX web server replicas deployed must be carefully adjusted based on the configuration of the Kubernetes worker nodes.
99+
For example, in a cluster where each worker node is configured with 4 vCPUs and 8 GB of memory (m3.medium), a larger number of replicas may be
100+
required to saturate available resources and trigger the provisioning of additional nodes.
101+
102+
```
103+
kubectl scale deployment --replicas=120 nginx-deployment
104+
```
105+
106+
```
107+
deployment.apps/nginx-deployment scaled
108+
109+
```
110+
111+
```
112+
kubectl get deployments
113+
```
114+
115+
```
116+
NAME READY UP-TO-DATE AVAILABLE AGE
117+
nginx-deployment 101/120 120 101 14m
118+
$ kubectl get deployments
119+
NAME READY UP-TO-DATE AVAILABLE AGE
120+
nginx-deployment 120/120 120 120 20m
121+
$ os coe cluster list
122+
+--------------------------------------+-----------+---------+------------+--------------+-----------------+---------------+
123+
| uuid | name | keypair | node_count | master_count | status | health_status |
124+
+--------------------------------------+-----------+---------+------------+--------------+-----------------+---------------+
125+
| cae2a382-26a5-438d-bbdc-e694249bbede | mycluster | xxxxxx | 1 | 1 | CREATE_COMPLETE | HEALTHY |
126+
+--------------------------------------+-----------+---------+------------+--------------+-----------------+---------------+
127+
$ kubectl get nodes
128+
NAME STATUS ROLES AGE VERSION
129+
mycluster-l76uten6iljx-control-plane-xlmq4 Ready control-plane 51m v1.31.1
130+
mycluster-l76uten6iljx-default-worker-4dqrj-br8p9 Ready <none> 66s v1.31.1
131+
mycluster-l76uten6iljx-default-worker-4dqrj-cwmjq Ready <none> 48m v1.31.1
132+
133+
```
134+
135+
8. Scaling down the nginx application deployment
136+
137+
```
138+
kubectl scale deployment --replicas=2 nginx-deployment
139+
```
140+
141+
```
142+
deployment.apps/nginx-deployment scaled
143+
144+
```
145+
146+
```
147+
kubectl get deployments
148+
```
149+
150+
```
151+
NAME READY UP-TO-DATE AVAILABLE AGE
152+
nginx-deployment 2/2 2 2 37m
153+
$ kubectl get nodes
154+
NAME STATUS ROLES AGE VERSION
155+
mycluster-l76uten6iljx-control-plane-xlmq4 Ready control-plane 100m v1.31.1
156+
mycluster-l76uten6iljx-default-worker-4dqrj-cwmjq Ready <none> 97m v1.31.1
157+
$ os coe cluster list
158+
+--------------------------------------+-----------+---------+------------+--------------+-----------------+---------------+
159+
| uuid | name | keypair | node_count | master_count | status | health_status |
160+
+--------------------------------------+-----------+---------+------------+--------------+-----------------+---------------+
161+
| cae2a382-26a5-438d-bbdc-e694249bbede | mycluster | xxxxxx | 1 | 1 | CREATE_COMPLETE | HEALTHY |
162+
+--------------------------------------+-----------+---------+------------+--------------+-----------------+---------------+
163+
164+
```
165+
166+
Note: Please allow several minutes for the scale-down process to complete, as the typical duration ranges between 7 and 10 minutes.
167+
## More information
168+
169+
For more information, refer to:
170+
- [Cluster Autoscaler](https://cluster-api.sigs.k8s.io/tasks/automated-machine-management/autoscaling)

_kubernetes/01-overview.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
title: Overview
33
order: 1
4-
duration: 1
4+
duration: 10
55
---
66

77
This tutorial will show you how to use Kubernetes on the Nectar Research Cloud.
88

99
### What you'll learn
1010

1111
- Create a Kubernetes cluster using Magnum
12+
- Administer your newly created Kubernetes cluster
1213
- Create a service using Pods
13-
- Create a Loadbalancer to allow external access to your service
1414
- Use a ReplicaSet for High Availability
1515
- Scale your cluster
16-
- Use Cinder volumes for storage
16+
- Create a Ingress to allow external access to your service
17+
- Create a Gateway to allow external access to your service
1718

1819
### What you'll need
1920

0 commit comments

Comments
 (0)