From 4ac73c41bdc85a6823f880a079d20cf1bccba729 Mon Sep 17 00:00:00 2001 From: Alan Dooley Date: Mon, 1 Dec 2025 10:26:52 +0000 Subject: [PATCH] feat: Hide example output with details shortcode This pull request hides the example output of commands using the Hugo details shortcode. It is an interactive element that is closed by default. Since the example output is optional, this reduces the amount of visible noise on the page, making it faster to read. --- content/ngf/get-started.md | 53 +++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/content/ngf/get-started.md b/content/ngf/get-started.md index beb65dcb7..0241ff54c 100644 --- a/content/ngf/get-started.md +++ b/content/ngf/get-started.md @@ -57,6 +57,8 @@ Run the following command: kind create cluster --config cluster-config.yaml ``` +{{< details summary="Example output" >}} + ```text Creating cluster "kind" ... ✓ Ensuring node image (kindest/node:v1.31.0) 🖼 @@ -73,6 +75,8 @@ kubectl cluster-info --context kind-kind Thanks for using kind! 😊 ``` +{{< /details >}} + {{< call-out "note" >}} If you have cloned [the NGINX Gateway Fabric repository](https://github.com/nginx/nginx-gateway-fabric/tree/main), you can also create a kind cluster from the root folder with the following _make_ command: @@ -92,6 +96,8 @@ Use `kubectl` to add the API resources for NGINX Gateway Fabric with the followi kubectl kustomize "https://github.com/nginx/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=v{{< version-ngf >}}" | kubectl apply -f - ``` +{{< details summary="Example output" >}} + ```text customresourcedefinition.apiextensions.k8s.io/gatewayclasses.gateway.networking.k8s.io created customresourcedefinition.apiextensions.k8s.io/gateways.gateway.networking.k8s.io created @@ -100,6 +106,8 @@ customresourcedefinition.apiextensions.k8s.io/httproutes.gateway.networking.k8s. customresourcedefinition.apiextensions.k8s.io/referencegrants.gateway.networking.k8s.io created ``` +{{< /details >}} + ### Install the Helm chart Use `helm` to install NGINX Gateway Fabric, specifying the NodePort configuration that will be set on the @@ -113,6 +121,8 @@ helm install ngf oci://ghcr.io/nginx/charts/nginx-gateway-fabric --create-namesp The port value should equal the _containerPort_ value from _cluster-config.yaml_ [when you created the kind cluster](#set-up-a-kind-cluster). The _listenerPort_ value will match the port that we expose in the Gateway listener. {{< /call-out >}} +{{< details summary="Example output" >}} + ```text NAME: ngf LAST DEPLOYED: Tue Apr 29 14:45:14 2025 @@ -122,6 +132,8 @@ REVISION: 1 TEST SUITE: None ``` +{{< /details >}} + ## Create an example application In the previous section, you deployed NGINX Gateway Fabric to a local cluster. This section shows you how to deploy a simple web application to test that NGINX Gateway Fabric works. @@ -205,6 +217,8 @@ EOF kubectl apply -f cafe.yaml ``` +{{< details summary="Example output" >}} + ```text deployment.apps/coffee created service/coffee created @@ -212,18 +226,24 @@ deployment.apps/tea created service/tea created ``` +{{< /details >}} + Verify that the new pods are in the `default` namespace: ```shell kubectl -n default get pods ``` +{{< details summary="Example output" >}} + ```text NAME READY STATUS RESTARTS AGE coffee-676c9f8944-k2bmd 1/1 Running 0 9s tea-6fbfdcb95d-9lhbj 1/1 Running 0 9s ``` +{{< /details >}} + ### Create Gateway and HTTPRoute resources Run the following command to create the file _gateway.yaml_, which is then used to deploy a Gateway to your cluster: @@ -245,16 +265,14 @@ EOF kubectl apply -f gateway.yaml ``` -```text -gateway.gateway.networking.k8s.io/gateway created -``` - Verify that the NGINX deployment has been provisioned: ```shell kubectl -n default get pods ``` +{{< details summary="Example output" >}} + ```text NAME READY STATUS RESTARTS AGE coffee-676c9f8944-k2bmd 1/1 Running 0 31s @@ -262,6 +280,8 @@ gateway-nginx-66b5d78f8f-4fmtb 1/1 Running 0 13s tea-6fbfdcb95d-9lhbj 1/1 Running 0 31s ``` +{{< /details >}} + 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 @@ -307,11 +327,6 @@ EOF kubectl apply -f cafe-routes.yaml ``` -```text -httproute.gateway.networking.k8s.io/coffee created -httproute.gateway.networking.k8s.io/tea created -``` - ### Verify the configuration You can check that all of the expected services are available using `kubectl get`: @@ -320,6 +335,8 @@ You can check that all of the expected services are available using `kubectl get kubectl -n default get services ``` +{{< details summary="Example output" >}} + ```text NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE coffee ClusterIP 10.96.206.93 80/TCP 2m2s @@ -328,12 +345,16 @@ kubernetes ClusterIP 10.96.0.1 443/TCP 142m tea ClusterIP 10.96.43.183 80/TCP 2m2s ``` +{{< /details >}} + You can also use `kubectl describe` on the new resources to check their status: ```shell kubectl -n default describe httproutes ``` +{{< details summary="Example output" >}} + ```text Name: coffee Namespace: default @@ -445,10 +466,14 @@ Status: Events: ``` +{{< /details >}} + ```shell kubectl -n default describe gateways ``` +{{< details summary="Example output" >}} + ```text Name: gateway Namespace: default @@ -524,6 +549,8 @@ Status: Events: ``` +{{< /details >}} + ## Test NGINX Gateway Fabric By configuring the cluster with the port `31437`, there is implicit port forwarding from your local machine to NodePort, allowing for direct communication to the NGINX Gateway Fabric service. @@ -534,6 +561,8 @@ You can use `curl` to test the new services by targeting the hostname (_cafe.exa curl --resolve cafe.example.com:8080:127.0.0.1 http://cafe.example.com:8080/coffee ``` +{{< details summary="Example output" >}} + ```text Server address: 10.244.0.16:8080 Server name: coffee-676c9f8944-k2bmd @@ -542,10 +571,14 @@ URI: /coffee Request ID: f34e138922171977a79b1b0d0395b97e ``` +{{< /details >}} + ```shell curl --resolve cafe.example.com:8080:127.0.0.1 http://cafe.example.com:8080/tea ``` +{{< details summary="Example output" >}} + ```text Server address: 10.244.0.17:8080 Server name: tea-6fbfdcb95d-9lhbj @@ -554,6 +587,8 @@ URI: /tea Request ID: 1b5c8f3a4532ea7d7510cf14ffeb27af ``` +{{< /details >}} + ## Next steps - [Install NGINX Gateway Fabric]({{< ref "/ngf/install/" >}}), for additional ways to install NGINX Gateway Fabric