I am trying to implement consul service mesh in my application and I am not able to make it work with Nginx Ingress. I have following config of the ingress:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
nginx.ingress.kubernetes.io/use-regex: "true"
name: static-server-ingress
namespace: default
spec:
rules:
- host: static.testdomain.com
http:
paths:
- backend:
service:
name: static-server
port:
number: 80
path: /*
pathType: Prefix
tls:
- hosts:
- static.testdomain.com
secretName: wildcard-domain-tls-secret
I am using static server example from Consul portal:
apiVersion: v1
kind: Service
metadata:
name: static-server
spec:
selector:
app: static-server
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: static-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: static-server
spec:
replicas: 1
selector:
matchLabels:
app: static-server
template:
metadata:
name: static-server
labels:
app: static-server
annotations:
'consul.hashicorp.com/connect-inject': 'true'
'consul.hashicorp.com/transparent-proxy': 'true'
spec:
containers:
- name: static-server
image: hashicorp/http-echo:latest
args:
- -text="hello world"
- -listen=:8080
ports:
- containerPort: 8080
name: http
serviceAccountName: static-server
In Nginx I have added following annotations:
annotations:
consul.hashicorp.com/connect-inject: "true"
consul.hashicorp.com/transparent-proxy: "true"
consul.hashicorp.com/transparent-proxy-exclude-inbound-ports: 8000,80,443,9000,8443
consul.hashicorp.com/transparent-proxy-exclude-outbound-cidrs: 10.64.0.1/32