Trouble configuring Ingress for Helm Chart

Hey everyone!

I am trying to deploy jupyterhub via helm chart on EKS. In our organization, our devops guys have set up nginx ingress controller so we usually use ingress for a service like this to get a relative path

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ${CI_PROJECT_NAME}
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    nginx.ingress.kubernetes.io/rewrite-target: ${URL_PREFIX}/$2
spec:
  rules:
  - http:
      paths:
      - path: ${URL_PREFIX}(/|$)(.*)
        backend:
          serviceName: ${CI_PROJECT_NAME}
          servicePort: 80

With this ingress rule, our service becomes available at https://base-url/${URL_PREFIX}/

I am trying to do something similar in the helm chart configuration but so far no luck. I can access jupyterhub via port forward

kubectl port-forward svc/proxy-public 8000:80 -n jupyterhub-dev

but not via ingress
https://base-url/jupyter/

Here is my config.yaml

proxy:

  secretToken: "a32a761120a1fdc24de797fae659041b5cfe8798adfaae9f0c0eb1c75233295a"

  service:

    type: ClusterIP

singleuser:

  extraEnv:

    EDITOR: "nano"

  defaultUrl: "/lab"

  cpu:

    limit: 1

    guarantee: 0.5

  memory:

    limit: 2G

    guarantee: 1G

ingress:

  enabled: true

  hosts:

    - ""

  pathSuffix: /jupyter(/|$)(.*)

  annotations:

    kubernetes.io/ingress.class: nginx

    nginx.ingress.kubernetes.io/force-ssl-redirect: "false"

    nginx.ingress.kubernetes.io/ssl-redirect: "false"

    nginx.ingress.kubernetes.io/rewrite-target: /jupyter/$2

Does anyone has some tips regarding the same? Thanks!

Welcome to the forum!

Have you tried setting a host instead of ""?

If you want to run JupyterHub under a prefix you should set

hub:
  baseUrl: /jupyter

in your config instead. This will configure JupyterHub to run under that prefix, and the Helm Chart will automatically add that to the ingress configuration, you shouldn’t need to specify pathSuffix. I thought this was in the Z2JH docs but I can’t find it :disappointed_relieved:

Hi @manics . Thank you for the reply.

Our cluster’s base url is “a.b.c.com

While setting up ingress for normal API’s in our cluster setup, we do not provide host parameter as show in my post.

An example of how the service ingress look like in our cluster

$ kubectl get ingress service-api -n analysis-dev -o wide
NAME          HOSTS   ADDRESS        PORTS   AGE
service-api   *       172.xx.81.xx   80      218d

On setting
hosts:
- “”
I get
$ kubectl get ingress -n jupyterhub-dev
NAME HOSTS ADDRESS PORTS AGE
jupyterhub * 172.xx.81.xx 80 94m

So the hosts is similar to other ingress resources running in our cluster .i.e a wildcard

In the jupyterhub config, I tried setting up
hosts:
- “a.b.c.com
hub:
baseUrl: /jupyter

but this caused 404 error in other running API’s :grimacing:

Next, I tried
hosts:
- “a.b.c.com/jupyter
hub:
baseUrl: /
But this gave error

spec.rules[0].host: Invalid value: "https://a.b.c.com": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

hosts: should be just a hostname, without a path, so something like a.b.c.com.

Did jupyterhub work though? If not can you show the output of kubectl get ingress in your jupyterhub namespace?

Thanks for your help @manics

We finally managed to fix the issue. I just want to give an update here.
The problem was with our network policy. We had to explicitly allow ingress to port 8000. Now it is working fine :smiley:

1 Like