Skip to content

Commit eb5697a

Browse files
committed
updates based on NGF 2.x architecture Signed-off-by: Daniel Edgar <d.edgar@f5.com>
Signed-off-by: Daniel Edgar <aknot242@gmail.com>
1 parent 637fab2 commit eb5697a

File tree

3 files changed

+57
-24
lines changed

3 files changed

+57
-24
lines changed

examples/nginx-gateway-fabric/ARTICLE.md

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,25 @@ If you instead wish to use the NGINX Open Source edition of NGF, you will need t
9393
1. Create a Secret to pull the NGF container from the F5 private registry. The secret is based on the contents of the trial JWT from MyF5. If you do not have a trial JWT, you can request one [here](https://www.f5.com/trials/free-trial-connectivity-stack-kubernetes).
9494

9595
```shell
96-
kubectl create secret docker-registry nginx-plus-registry-secret --docker-server=private-registry.nginx.com --docker-username=`cat the_full_path_to_you_jwt_here` --docker-password=none -n nginx-gateway
96+
kubectl create secret docker-registry nginx-plus-registry-secret --docker-server=private-registry.nginx.com --docker-username=`cat the_full_path_to_your_jwt_here` --docker-password=none -n nginx-gateway
97+
```
98+
99+
1. Create a Secret that will contain the NGINX Plus license file. This will be from the same JWT file as used in the previous step:
100+
101+
```shell
102+
kubectl create secret generic nplus-license --from-literal=license.jwt=`cat the_full_path_to_your_jwt_here` -n nginx-gateway
97103
```
98104

99105
1. The Kubernetes Gateway API is not included in clusters by default. We need to install its Custom Resource Definitions (CRDs) in order to use it:
100106

101107
```shell
102-
kubectl kustomize "https://github.com/nginxinc/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=v1.3.0" | kubectl apply -f -
108+
kubectl kustomize "https://github.com/nginx/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=v2.2.1" | kubectl apply -f -
103109
```
104110

105111
1. Next, we will install NGF via its Helm chart:
106112

107113
```shell
108-
helm install ngf oci://ghcr.io/nginxinc/charts/nginx-gateway-fabric --set nginx.image.repository=private-registry.nginx.com/nginx-gateway-fabric/nginx-plus --set nginx.plus=true --set serviceAccount.imagePullSecret=nginx-plus-registry-secret -n nginx-gateway --version 1.3.0
114+
helm install ngf oci://ghcr.io/nginx/charts/nginx-gateway-fabric --set nginx.image.repository=private-registry.nginx.com/nginx-gateway-fabric/nginx-plus --set nginx.plus=true --set nginx.imagePullSecret=nginx-plus-registry-secret -n nginx-gateway --version 2.2.1
109115
```
110116

111117
1. Run the following command to wait until NGF has been verified as deployed:
@@ -124,7 +130,7 @@ If you instead wish to use the NGINX Open Source edition of NGF, you will need t
124130
1. Install Prometheus on your cluster in its own namespace:
125131
126132
```shell
127-
helm install prometheus prometheus-community/prometheus -n prometheus --create-namespace --set server.global.scrape_interval=15s
133+
helm install prometheus prometheus-community/prometheus -n prometheus --create-namespace --set server.global.scrape_interval=15s --set server.global.evaluation_interval=15s
128134
```
129135
130136
1. Create a namespace for Argo Rollouts, and install it using manifests from the project's GitHub repo:
@@ -136,10 +142,12 @@ If you instead wish to use the NGINX Open Source edition of NGF, you will need t
136142

137143
1. Install the Argo Rollouts CLI using the [instructions](https://argoproj.github.io/argo-rollouts/installation/#kubectl-plugin-installation) for your client platform.
138144

139-
1. Install the Gateway API Plugin for Argo Rollouts:
145+
1. Create a `gateway-plugin.yaml` file based on the instructions on the [Argo Rollouts Gateway API plugin](https://rollouts-plugin-trafficrouter-gatewayapi.readthedocs.io/en/latest/installation/#installing-the-plugin-via-https) page.
146+
147+
1. Install the Gateway API Plugin for Argo Rollouts from the yaml file you created in the previous step:
140148

141149
```shell
142-
kubectl apply -f gateway-plugin.yml -n argo-rollouts
150+
kubectl apply -f gateway-plugin.yaml -n argo-rollouts
143151
```
144152

145153
1. Restart the Argo Rollouts controller so that it detects the presence of the plugin.
@@ -151,7 +159,7 @@ If you instead wish to use the NGINX Open Source edition of NGF, you will need t
151159
1. Then, check the controller logs. You should see a line for loading the plugin:
152160

153161
```shell
154-
time="XXX" level=info msg="Downloading plugin argoproj-labs/gatewayAPI from: https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/releases/download/v0.2.0/gateway-api-plugin-linux-amd64"
162+
time="XXX" level=info msg="Downloading plugin argoproj-labs/gatewayAPI from: https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-gatewayapi/releases/download/v0.8.0/gateway-api-plugin-linux-arm64"
155163
time="YYY" level=info msg="Download complete, it took 7.792426599s"
156164
```
157165

@@ -199,6 +207,31 @@ Now that our cluster services are in place, we will now use NGF and Argo Rollout
199207
***Why do we need two different services that contain the same app selector?***
200208
When implementing a Canary deployment, Argo Rollouts requires two different Kubernetes services: A "stable" service, and a "canary" service. The "stable" service will direct traffic to the initial deployment of the application. In subsequent (or "canary") deployments, Argo Rollouts will transparently configure the "canary" service to use the endpoints exposed by the pods referenced in the new deployment. NGF will use both of these services to split traffic between these two defined services based on the Argo Rollout rules.
201209

210+
1. The argo-rollouts service account needs the ability to be able to view and modify HTTPRoutes as well as its existing permissions. Edit the `argo-rollouts` cluster role to add the following permissions to `rules:`:
211+
212+
```yaml
213+
- apiGroups:
214+
- gateway.networking.k8s.io
215+
resources:
216+
- httproutes
217+
verbs:
218+
- get
219+
- list
220+
- watch
221+
- update
222+
- patch
223+
```
224+
225+
1. Additionally, the argo-rollouts service account needs the ability to be able to create ConfigMaps as well as its existing permissions. Edit the `argo-rollouts` cluster role to add the following permissions:
226+
227+
```yaml
228+
- apiGroups: [""]:
229+
resources:
230+
- configmaps
231+
verbs:
232+
- create
233+
```
234+
202235
1. Now we will deploy the `AnalysisTemplate` resource, provided by Argo Rollouts. This resource contains the rules to assess a deployment's health, and how to interpret this data. In this demo, we will be using Prometheus query to examine the canary service's upstream pods for the absence of 4xx and 5xx HTTP response codes as an indication of its health.
203236

204237
```shell
@@ -237,11 +270,11 @@ Now that our cluster services are in place, we will now use NGF and Argo Rollout
237270
- There are 8 steps to this progressive rollout. Refer to the `rollout.yaml` file to see the configured stages.
238271
- You should see that the rollout is `Progressing`, awaiting a canary rollout.
239272
240-
1. Open a new shell window, and set up a port forward to the NGF pod's NGINX container:
273+
1. Open a new shell window, and set up a port forward to the NGF pod's NGINX container that is hosting the gateway:
241274

242275
```shell
243-
NGINX_POD=`kubectl get pods --selector=app.kubernetes.io/name=nginx-gateway-fabric -n nginx-gateway -o=name`
244-
kubectl port-forward $NGINX_POD -n nginx-gateway 8080:80
276+
NGINX_POD=`kubectl get pods --selector=app.kubernetes.io/name=rollouts-demo-gateway-nginx -o=name`
277+
kubectl port-forward $NGINX_POD 8080:80
245278
```
246279

247280
> Note: In a production scenario, we would not have used a port forward. Rather, we would have likely used a `Service` type `LoadBalancer` to reach the NGF instance. However, this requires additional setup, and varies greatly depending on where your cluster is hosted.
@@ -311,7 +344,7 @@ We have just seen what an ideal rollout looks like. What about a rollout where f
311344
![canary rollout ui red](images/canary-rollout-red-ui.png)
312345

313346
1. Wait at least a minute, and you should see something like this:
314-
347+
˜˜
315348
![canary rollout ui red rollback](images/canary-rollout-red-rollback-ui.png)
316349

317350
> Note: You will see a portion of red service responses for about a minute, then reverts back to 100% yellow. Why? Look at the kubectl argo rollouts plugin to see what is going on. You may observe that the AnalysisRun has failed at least one time, triggering Argo Rollouts to perform an automatic rollback to the last successful rollout version. Cool, right?
@@ -320,4 +353,4 @@ We have just seen what an ideal rollout looks like. What about a rollout where f
320353

321354
## Conclusion
322355

323-
This was only a taste of what can be accomplished with Argo Rollouts and NGINX Gateway Fabric. However, I hope you have witnessed the benefits of adopting progressive delivery patters using tools such as these. I would encourage you to further explore what you are able to accomplish in your own environments.
356+
This was only a taste of what can be accomplished with Argo Rollouts and NGINX Gateway Fabric. However, I hope you have witnessed the benefits of adopting progressive delivery patterns using tools such as these. I would encourage you to further explore what you are able to accomplish in your own environments.

examples/nginx-gateway-fabric/analysis-success-rate.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ spec:
1616
prometheus:
1717
address: http://prometheus-server.prometheus
1818
query: >+
19-
sum(rate(
20-
nginx_gateway_fabric_upstream_server_responses{upstream="{{args.namespace}}_{{args.service-name}}_{{args.service-port}}",
21-
code!~"[4-5].*"}[1m])
22-
) by (upstream)
23-
/
24-
sum(rate(
25-
nginx_gateway_fabric_upstream_server_responses{upstream="{{args.namespace}}_{{args.service-name}}_{{args.service-port}}"}[1m])
26-
) by (upstream)
27-
unless sum(rate(
28-
nginx_gateway_fabric_upstream_server_responses{upstream="{{args.namespace}}_{{args.service-name}}_{{args.service-port}}"}[1m])
29-
) by (upstream) == 0
19+
sum(rate(
20+
nginx_http_upstream_peer_responses_total{nginx_upstream_name="{{args.namespace}}_{{args.service-name}}_{{args.service-port}}",
21+
nginx_status_range!~"[4-5].*"}[1m])
22+
) by (nginx_upstream_name)
23+
/
24+
sum(rate(
25+
nginx_http_upstream_peer_responses_total{nginx_upstream_name="{{args.namespace}}_{{args.service-name}}_{{args.service-port}}"}[1m])
26+
) by (nginx_upstream_name)
27+
unless sum(rate(
28+
nginx_http_upstream_peer_responses_total{nginx_upstream_name="{{args.namespace}}_{{args.service-name}}_{{args.service-port}}"}[1m])
29+
) by (nginx_upstream_name) == 0

examples/nginx-gateway-fabric/gateway.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: gateway.networking.k8s.io/v1beta1
1+
apiVersion: gateway.networking.k8s.io/v1
22
kind: Gateway
33
metadata:
44
name: rollouts-demo-gateway

0 commit comments

Comments
 (0)