From 13592b52d003c34486945d5bac6058395eb0d35a Mon Sep 17 00:00:00 2001 From: shaun-nx Date: Tue, 8 Jul 2025 14:44:29 +0100 Subject: [PATCH 1/4] Add single-line commands to deploy demo applications in Get Started guide --- content/ngf/get-started.md | 152 ++++++++++++++++++++++++++++++++----- 1 file changed, 131 insertions(+), 21 deletions(-) diff --git a/content/ngf/get-started.md b/content/ngf/get-started.md index 83bd9029f..9cae6f421 100644 --- a/content/ngf/get-started.md +++ b/content/ngf/get-started.md @@ -132,13 +132,77 @@ The YAML code in the following sections can be found in the [cafe-example folder ### Create the application resources -Create the file _cafe.yaml_ with the following contents: - -{{< ghcode `https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/refs/heads/main/examples/cafe-example/cafe.yaml`>}} - -Apply it using `kubectl`: - -```shell +Run the below command to deploy the **coffee* application into your cluster. +This command will also create a file called `cafe.yaml` in your current working directory: + +```yaml +cat < cafe.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: coffee +spec: + replicas: 1 + selector: + matchLabels: + app: coffee + template: + metadata: + labels: + app: coffee + spec: + containers: + - name: coffee + image: nginxdemos/nginx-hello:plain-text + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: coffee +spec: + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: coffee +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tea +spec: + replicas: 1 + selector: + matchLabels: + app: tea + template: + metadata: + labels: + app: tea + spec: + containers: + - name: tea + image: nginxdemos/nginx-hello:plain-text + ports: + - containerPort: 8080 +--- +apiVersion: v1 +kind: Service +metadata: + name: tea +spec: + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: tea +EOF kubectl apply -f cafe.yaml ``` @@ -163,13 +227,23 @@ tea-6fbfdcb95d-9lhbj 1/1 Running 0 9s ### Create Gateway and HTTPRoute resources -Create the file _gateway.yaml_ with the following contents: - -{{< ghcode `https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/refs/heads/main/examples/cafe-example/gateway.yaml`>}} - -Apply it using `kubectl`: - -```shell +Run the below command to deploy a gateway your cluster. +This command will also create a file called `gateway.yaml` in your current working directory: + +```yaml +cat < gateway.yaml +apiVersion: gateway.networking.k8s.io/v1 +kind: Gateway +metadata: + name: gateway +spec: + gatewayClassName: nginx + listeners: + - name: http + port: 80 + protocol: HTTP + hostname: "*.example.com" +EOF kubectl apply -f gateway.yaml ``` @@ -190,13 +264,49 @@ gateway-nginx-66b5d78f8f-4fmtb 1/1 Running 0 13s tea-6fbfdcb95d-9lhbj 1/1 Running 0 31s ``` -Create the file _cafe-routes.yaml_ with the following contents: - -{{< ghcode `https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/refs/heads/main/examples/cafe-example/cafe-routes.yaml`>}} - -Apply it using `kubectl`: - -```shell +Run the below command to deploy a two `HTTPRoute`resources into your cluster. One for `/coffee` and one for `/tea`. +This command will also create a file called `cafe-routes.yaml` in your current working directory: + +```yaml +cat < cafe-routes.yaml +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: coffee +spec: + parentRefs: + - name: gateway + sectionName: http + hostnames: + - "cafe.example.com" + rules: + - matches: + - path: + type: PathPrefix + value: /coffee + backendRefs: + - name: coffee + port: 80 +--- +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: tea +spec: + parentRefs: + - name: gateway + sectionName: http + hostnames: + - "cafe.example.com" + rules: + - matches: + - path: + type: Exact + value: /tea + backendRefs: + - name: tea + port: 80 +EOF kubectl apply -f cafe-routes.yaml ``` From 8d713edf0fb3103e468d0b2c14acc5ae5f858ad3 Mon Sep 17 00:00:00 2001 From: Shaun Date: Fri, 11 Jul 2025 10:55:30 +0100 Subject: [PATCH 2/4] Update content/ngf/get-started.md Co-authored-by: Alan Dooley --- content/ngf/get-started.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/ngf/get-started.md b/content/ngf/get-started.md index 9cae6f421..2a4ef8cf0 100644 --- a/content/ngf/get-started.md +++ b/content/ngf/get-started.md @@ -132,8 +132,7 @@ The YAML code in the following sections can be found in the [cafe-example folder ### Create the application resources -Run the below command to deploy the **coffee* application into your cluster. -This command will also create a file called `cafe.yaml` in your current working directory: +Run the following command to create the file _cafe.yaml_, which is then used to deploy the *coffee* application to your cluster: ```yaml cat < cafe.yaml From 3212906c6e42daaefc86c9db3702aea0dadaf35c Mon Sep 17 00:00:00 2001 From: Shaun Date: Fri, 11 Jul 2025 10:55:39 +0100 Subject: [PATCH 3/4] Update content/ngf/get-started.md Co-authored-by: Alan Dooley --- content/ngf/get-started.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/ngf/get-started.md b/content/ngf/get-started.md index 2a4ef8cf0..dec526dab 100644 --- a/content/ngf/get-started.md +++ b/content/ngf/get-started.md @@ -226,8 +226,7 @@ tea-6fbfdcb95d-9lhbj 1/1 Running 0 9s ### Create Gateway and HTTPRoute resources -Run the below command to deploy a gateway your cluster. -This command will also create a file called `gateway.yaml` in your current working directory: +Run the following command to create the file _gateway.yaml_, which is then used to deploy a Gateway to your cluster: ```yaml cat < gateway.yaml From 70aeb5cf725251eaa2e31676f9e4cfb709efb2bb Mon Sep 17 00:00:00 2001 From: Shaun Date: Fri, 11 Jul 2025 10:55:48 +0100 Subject: [PATCH 4/4] Update content/ngf/get-started.md Co-authored-by: Alan Dooley --- content/ngf/get-started.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/ngf/get-started.md b/content/ngf/get-started.md index dec526dab..aead2c963 100644 --- a/content/ngf/get-started.md +++ b/content/ngf/get-started.md @@ -262,8 +262,7 @@ gateway-nginx-66b5d78f8f-4fmtb 1/1 Running 0 13s tea-6fbfdcb95d-9lhbj 1/1 Running 0 31s ``` -Run the below command to deploy a two `HTTPRoute`resources into your cluster. One for `/coffee` and one for `/tea`. -This command will also create a file called `cafe-routes.yaml` in your current working directory: +Run the following command to create the file _cafe-routes.yaml_. It is then used to deploy two *HTTPRoute* resources in your cluster: one each for _/coffee_ and _/tea_. ```yaml cat < cafe-routes.yaml