"I'm facing a problem with my Kubernetes Ingress and OAuth2 Proxy. When accessing my application through the Ingress, I expect to be redirected to the Okta authentication page, but I'm getting 500 Internal Server Error.Here is my conf
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/auth-signin: https://appli-test.kube.fr/oauth2/start?rd=$escaped_request_uri
nginx.ingress.kubernetes.io/auth-url: https://appli-test.kube.fr/oauth2/auth
name: ingress
namespace: h1
spec:
ingressClassName: nginx
rules:
- host: appli-test.kube.fr
http:
paths:
- backend:
service:
name: backend
port:
number: 8800
path: /api
pathType: Prefix
- backend:
service:
name: frontend
port:
number: 80
path: /
pathType: Prefix
tls:
- hosts:
- appli-test.kube.fr
secretName: test-tl
the conf of my deployment :
spec:
containers:
- args:
- '--http-address=0.0.0.0:4180'
- '--https-address=0.0.0.0:4443'
- '--metrics-address=0.0.0.0:44180'
- '--config=/etc/oauth2_proxy/oauth2_proxy.cfg'
env:
- name: OAUTH2_PROXY_CLIENT_ID
valueFrom:
secretKeyRef:
key: client-id
name: oauth2-proxy
- name: OAUTH2_PROXY_CLIENT_SECRET
valueFrom:
secretKeyRef:
key: client-secret
name: oauth2-proxy
- name: OAUTH2_PROXY_COOKIE_SECRET
valueFrom:
secretKeyRef:
key: cookie-secret
name: oauth2-proxy
my configmap
oauth2_proxy.cfg: >
provider = "oidc"
redirect_url = "http://appli-test.kube.fr/oauth2/callback"
oidc_issuer_url =
"https://dev-xxxx.okta.com/oauth2/xxxx"
upstreams = [
"http://appli-test.kube.fr"
]
email_domains = [
"*"
]
client_id = "xxx"
client_secret = "xxxx"
pass_access_token = true
cookie_secret = "xxx"
skip_provider_button = true
and the service of oauth-proxy :
spec:
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
- appProtocol: http
name: http
port: 4180
protocol: TCP
targetPort: http
- appProtocol: http
name: metrics
port: 44180
protocol: TCP
targetPort: metrics
selector:
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/name: oauth2-proxy
sessionAffinity: None
type: ClusterIP
i didnt create any ingress for the oauth-proxy Thank you in advance for your assistance!