-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,49 @@ | ||
# ingress-playground | ||
|
||
TCP and UDP services for deployment in Kubernetes to explore ingress | ||
TCP and UDP services for deployment in Kubernetes to explore ingress | ||
|
||
## Deployment | ||
```bash | ||
kubectl apply -f tcp-server-ss.yaml | ||
kubectl apply -f udp-server-ss.yaml | ||
``` | ||
|
||
## Minikube nginx ingress controller | ||
|
||
Create ingress-nginx-controller-patch.yaml | ||
```yaml | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: controller | ||
ports: | ||
- containerPort: 5000 | ||
hostPort: 5000 | ||
protocol: UDP | ||
- containerPort: 5001 | ||
hostPort: 5001 | ||
|
||
``` | ||
|
||
Configure ingress | ||
```bash | ||
kubectl patch configmap udp-services -n ingress-nginx --patch '{"data":{"5000":"default/udp-server-0-service:5000"}}' | ||
kubectl patch configmap tcp-services -n ingress-nginx --patch '{"data":{"5001":"default/tcp-server-0-service:5001"}}' | ||
kubectl patch deployment ingress-nginx-controller -n ingress-nginx --patch "$(cat ingress-nginx-controller-patch.yaml)" -n ingress-nginx | ||
``` | ||
|
||
Reach services on minikube ip (e.g. 192.168.49.2) | ||
|
||
## K3S With Traefic | ||
|
||
- On K3S master, create file `/var/lib/rancher/k3s/server/manifests/traefik-config.yaml` with additional ports to expose. See example in traefik directory | ||
|
||
- Create instances of IngressRouteTCP or IngressRouteUDP as needed | ||
```bash | ||
kubectl apply -f ingressRouteTcp.yaml | ||
kubectl apply -f ingressRouteUdp.yaml | ||
``` | ||
|
||
- Services should be available; check details from the `traefik` service in the `kube-system` namespace, as they may be on a load balancer IP if something like `metallb` is in use. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
apiVersion: traefik.containo.us/v1alpha1 | ||
kind: IngressRouteTCP | ||
metadata: | ||
name: tcp-server | ||
namespace: default | ||
spec: | ||
entryPoints: | ||
- tcp-server | ||
routes: | ||
- match: HostSNI(`*`) | ||
services: | ||
- name: tcp-server-0-service | ||
port: 5001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: traefik.containo.us/v1alpha1 | ||
kind: IngressRouteUDP | ||
metadata: | ||
name: udp-server | ||
namespace: default | ||
spec: | ||
entryPoints: | ||
- udp-server | ||
routes: | ||
- services: | ||
- name: udp-server-0-service | ||
port: 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
apiVersion: helm.cattle.io/v1 | ||
kind: HelmChartConfig | ||
metadata: | ||
name: traefik | ||
namespace: kube-system | ||
spec: | ||
valuesContent: |- | ||
ports: | ||
udp-server: | ||
port: 5000 | ||
expose: true | ||
exposedPort: 5000 | ||
protocol: UDP | ||
tcp-server: | ||
port: 5001 | ||
expose: true | ||
exposedPort: 5001 | ||
protocol: TCP |