nginx-ingress

How to perform custom authentication with kubernetes Ingress

爷,独闯天下 提交于 2021-02-07 08:01:38
问题 I have deployed few services in kubernetes and using NGINX ingress to access outside.(Using EC2 instance for all cluster setup). Able to access service through host tied with ingress. Now instead of accessing the svc directly I am trying to add authentication and before accessing the service. And redirecting to login page , user enters credentials and should redirect to the asked page. The following code snipet I I tried so far. Please guide to find solution. my-ingress.yml apiVersion:

Rewrite only specific route with nginx Ingress

◇◆丶佛笑我妖孽 提交于 2021-02-07 07:00:22
问题 I have three services running in my backend and the Ingress routing is defined like this: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: myapp-ingress annotations: kubernetes.io/ingress.class: nginx certmanager.k8s.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/rewrite-target: / spec: tls: - hosts: - myapp.westeurope.cloudapp.azure.com secretName: acme-crt-secret rules: - host: myapp.westeurope.cloudapp.azure.com http: paths: - path: / backend: serviceName:

Connect to mongodb with mongoose both in kubernetes

我的梦境 提交于 2021-02-05 08:09:39
问题 I have a microservice which I developed and tested using docker-compose. Now I would like to deploy it to kubernetes. Part of my docker-compose file looks like this: tasksdb: container_name: tasks-db image: mongo:4.4.1 restart: always ports: - '6004:27017' volumes: - ./tasks_service/tasks_db:/data/db networks: - backend tasks-service: container_name: tasks-service build: ./tasks_service restart: always ports: - "5004:3000" volumes: - ./tasks_service/logs:/usr/src/app/logs - ./tasks_service

Apply nginx-ingress annotations at path level

允我心安 提交于 2021-02-04 08:10:02
问题 We are migrating from a traditional nginx deployment to a kubernetes nginx-ingress controller. I'm trying to apply settings at a location level, but can't see how to do so with annotations. For example, we had: server { listen 80; server_name example.com; location /allow-big-uploads { client_max_body_size 100M; ... } } And we translate to something like this: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: web-ingress annotations: nginx.ingress.kubernetes.io/proxy-body-size: 100m

Apply nginx-ingress annotations at path level

眉间皱痕 提交于 2021-02-04 08:07:27
问题 We are migrating from a traditional nginx deployment to a kubernetes nginx-ingress controller. I'm trying to apply settings at a location level, but can't see how to do so with annotations. For example, we had: server { listen 80; server_name example.com; location /allow-big-uploads { client_max_body_size 100M; ... } } And we translate to something like this: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: web-ingress annotations: nginx.ingress.kubernetes.io/proxy-body-size: 100m

ingress nginx redirect from www to https

房东的猫 提交于 2021-01-29 13:58:14
问题 I'm trying to redirect http://www... and https://www... to https://... using ingress-nginx. How can I do that? I've tried adding the following custom configuration using the annotation nginx.ingress.kubernetes.io/server-snippet and nginx.ingress.kubernetes.io/configuration-snippet : # 1 if($host = "www.example.com") { return 308 https://example.com$request_uri; } # 2 server { server_name www.example.com; return 308 https://example.com$request_uri; } # 3 server_name www.example.com; return 308

How to set ingress-nginx custom errors

只谈情不闲聊 提交于 2021-01-29 13:49:10
问题 I use the kubernetes ingress-nginx controller and a set custom errors on GKE but I have some problems. Goal: If a 50x error occurs in something-web-app , I'll return the HTTP status code 200 and JSON {"status":200, "message":"ok"} Problems: I have read the custom-errors document but there is no example of how to customize the default-backend . I do not understand the difference between ConfigMap and Annotation. How does ingress-nginx controller work in the first place. 回答1: You can do it

How to redirect custom subdomain of a domain to a single kubernetes service with subdomain as parameter/ path?

ε祈祈猫儿з 提交于 2021-01-29 11:08:46
问题 I have a requirement for a multitenant application where each tenant should be separated by sub domains like below t1.example.com t2.example.com t3.example.com . . . tn.example.com So there could be any number of tenants in this case. I have a Kubernetes Backend Service named myservice responsible for handling all those requests and they need to be identified based on their subdomain. e.g. if the request comes from tn.example.com then it needs to be redirected to the -> myservice/tn . t2

How to expose sentry on subpath in nginx ingress?

倖福魔咒の 提交于 2021-01-29 09:47:26
问题 I have Sentry running in my cluster and i want to expose it on subpath using nginx ingress but it seems that it only works on root path, i tried several ways but it didn't work. Is there any configuration i can perform in order to make it work on a subpath because i've seen some examples using these two variables in the sentry.conf.py file: SENTRY_URL_PREFIX = '/sentry' FORCE_SCRIPT_NAME = '/sentry' But i don't know if it works Here is the ingress resource for sentry : apiVersion: networking

Ingress -> Cluster IP back-end - got ERR_CONNECTION_REFUSED

旧巷老猫 提交于 2021-01-29 08:34:50
问题 I got ingress defined as: apiVersion: extensions/v1beta1 kind: Ingress metadata: name: wp-ingress namespace: wordpress annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/proxy-body-size: 25m spec: rules: - host: my.domain.com http: paths: - path: / backend: serviceName: wordpress servicePort: 6002 And the back-end, defined as Cluster IP running on 6002 port. When I am trying to reach ingress by its ADDRESS in the