Skip to content

Instantly share code, notes, and snippets.

@okgolove
Created October 25, 2018 08:49
Show Gist options
  • Select an option

  • Save okgolove/91026dd104265a71095e8e0ace0f047a to your computer and use it in GitHub Desktop.

Select an option

Save okgolove/91026dd104265a71095e8e0ace0f047a to your computer and use it in GitHub Desktop.
Nginx Ingress TCP Redirect
kubectl patch -n ingress deploy nginx-ingress-controller --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/ports/-", "value": {"containerPort": 8080, "name": "redirect", "protocol": "TCP"}}]'
rbac:
create: true
controller:
replicaCount: 2
config:
use-proxy-protocol: "True"
proxy-protocol: "True"
real-ip-header: "proxy_protocol"
set-real-ip-from: "0.0.0.0/0"
http-snippet: |
server {
listen 8080 proxy_protocol;
server_tokens off;
return 301 https://$host$request_uri;
}
service:
targetPorts:
http: redirect
https: http
annotations:
service.beta.kubernetes.io/aws-load-balancer-cross-zone-load-balancing-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "tcp"
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
service.beta.kubernetes.io/aws-load-balancer-ssl-negotiation-policy: "ELBSecurityPolicy-TLS-1-2-2017-01"
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"
service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600'
service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled: "true"
service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout: "60"
publishService:
enabled: true
stats:
enabled: true
metrics:
enabled: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment