Skip to content

Commit db791fe

Browse files
committed
docs: adds info on setting up host network access
1 parent e1116fb commit db791fe

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

site/content/installation/running-on-kind.md

+48-2
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,59 @@ To install NGINX Gateway Fabric, choose the appropriate installation guide that
4040
- [Installation with Helm]({{< relref "installation/installing-ngf/helm.md" >}})
4141
- [Installation with Kubernetes manifests]({{< relref "installation/installing-ngf/manifests.md" >}})
4242

43+
## Set up a NodePort
44+
45+
When using kind clusters, be aware that NodePort services require [additional setup](https://kind.sigs.k8s.io/docs/user/configuration/#nodeport-with-port-mappings).
46+
47+
For example, the following will automatically set up port forwarding into a local cluster (intended for development):
48+
49+
```yaml
50+
kind: Cluster
51+
apiVersion: kind.x-k8s.io/v1alpha4
52+
nodes:
53+
- role: control-plane
54+
extraPortMappings:
55+
- containerPort: 31437
56+
hostPort: 8080
57+
protocol: TCP
58+
- containerPort: 31438
59+
hostPort: 8443
60+
protocol: TCP
61+
---
62+
apiVersion: v1
63+
kind: Service
64+
metadata:
65+
name: nginx-gateway
66+
namespace: nginx-gateway # must be same namespace as your gateway
67+
labels:
68+
app.kubernetes.io/name: nginx-gateway
69+
app.kubernetes.io/instance: nginx-gateway
70+
app.kubernetes.io/version: "edge"
71+
spec:
72+
type: NodePort
73+
selector:
74+
app.kubernetes.io/name: nginx-gateway
75+
app.kubernetes.io/instance: nginx-gateway
76+
ports: # Update the following ports to match your Gateway Listener ports
77+
- name: http
78+
port: 80
79+
protocol: TCP
80+
targetPort: 80
81+
nodePort: 31437 # See https://kind.sigs.k8s.io/docs/user/configuration/#nodeport-with-port-mappings
82+
- name: https
83+
port: 443
84+
protocol: TCP
85+
targetPort: 443
86+
nodePort: 31438
87+
```
88+
4389
{{<note>}}
44-
When using kind clusters, be aware that NodePort services require [additional setup](https://kind.sigs.k8s.io/docs/user/configuration/#nodeport-with-port-mappings). Also, for LoadBalancer services, you’ll need a [third-party controller](https://kind.sigs.k8s.io/docs/user/loadbalancer/) like MetalLB to assign external IPs. The default Helm chart creates a LoadBalancer service; however, you can disable this by adding `--set service.create=false` to your Helm command. Afterward, you can [configure port forwarding](#configure-port-forwarding) as described below to access the examples.
90+
For LoadBalancer services, you’ll need a [third-party controller](https://kind.sigs.k8s.io/docs/user/loadbalancer/) like MetalLB to assign external IPs. The default Helm chart creates a LoadBalancer service; however, you can disable this by adding `--set service.create=false` to your Helm command. Afterward, you can [configure port forwarding](#configure-port-forwarding) as described below to access the examples.
4591
{{</note>}}
4692

4793
## Configure Port Forwarding {#configure-port-forwarding}
4894

49-
Once NGINX Gateway Fabric has been installed, you need to configure port forwarding from local ports **8080** and **8443** to ports **80** and **443** on the **nginx-gateway** Pod.
95+
Once NGINX Gateway Fabric has been installed, if you don't have port forwarding set with both the `NodePort` and `extraPortMappings`, you need to configure port forwarding from local ports **8080** and **8443** to ports **80** and **443** on the **nginx-gateway** Pod.
5096

5197
To configure port forwarding, run the following command:
5298

0 commit comments

Comments
 (0)