Kubernetes Ingress Component Deployment¶
Introduction¶
Nginx Ingress is an implementation of Kubernetes Ingress. It watches Ingress resources in the Kubernetes cluster and translates Ingress rules into Nginx configurations, enabling Nginx to perform Layer 7 traffic forwarding.
Prerequisites¶
- A Kubernetes cluster is deployed. If not, see Kubernetes Deployment.
- (Optional) Helm is deployed. If not, see Helm Installation.
Basic Information and Compatibility¶
| Name | Description |
|---|---|
| Ingress-nginx Version | 1.3.0 |
| Supported Cluster Version | 1.18+ |
| Ingress-nginx Port | 32280 |
| Offline Installation Support | Yes |
| Supported Architectures | amd64/arm64 |
Deployment Steps¶
1. Installation¶
For Kubernetes Ingress component deployment, refer to https://github.com/kubernetes/ingress-nginx.
- Kubernetes > 1.18
helm install ingress-nginx ingress-nginx \
--repo https://pubrepo.guance.com/chartrepo/dataflux-chart \
-n ingress-nginx --create-namespace
- Kubernetes = 1.18
- Kubernetes > 1.18
Download ingress-nginx.yaml.
Run the following command to install:
- Kubernetes = 1.18
Download ingress-nginx4.1.4.yaml.
Run the following command to install:
2. Verify Deployment¶
2.1 Check Pod Status¶
kubectl get pods -n ingress-nginx
NAME READY STATUS RESTARTS AGE
ingress-nginx-controller-7bf6c446bf-b7bq7 1/1 Running 1 26d
2.2 Query Port¶
Get the ingress-nginx NodePort.
Note
The NodePort may differ between Helm and Yaml deployments. In the example, ingress-nginx NodePorts are 32280 and 32483.
2.3 Create a Test Service¶
# Create a test deployment
kubectl create deployment ingress-test --image=nginx --port=80
# Create a test service
kubectl expose deployment ingress-test --port=80 --target-port=80
# Create a test ingress
kubectl create ingress ingress-test --rule='foo.com/=ingress-test:80'
2.4 Test¶
Note
192.168.100.101 is the Kubernetes node IP.
Successful output:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
2.5 Clean Up the Test Service¶
kubectl delete deployment ingress-test
kubectl delete svc ingress-test
kubectl delete ingress ingress-test