hashicorp / hashicorp/consul

Setup consul UI on Kubernetes + nginx ingress controller on path "/consul" instead of "/"

Open
#14,295 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

Hi all,
This may sound like a repeat question and I checked some similar answers but not sure what is going wrong with my setup, so asking this question here. (referred [issue#758](https://github.com/hashicorp/consul-helm/issues/758) and tried solution but not working for me).
I am sure I am doing something wrong - someone please help me.

**What I have so far:**
- Have a k8s cluster with metallb load balancer and nginx ingress controller already setup.

**What I expect:**
- With helm installation of consul, I need to setup consul ingress in such a way that the UI path should be: `myweb.mydommain.com/consul`

**What's happening:**
- After setup on consul, if I visit browser and type: myweb.mydomain.com/consul - I get following error:
`Invalid URL path: if attempting to use the HTTP API, ensure the path starts with '/v1/'
`
- But, If I change the "path" directive of consul ingress values in values.yaml from "/consul" to "/" , then `myweb.mydomain.com` shows me consul UI without any issues.

**My setup:**
K8s version:

```
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.10", GitCommit:"a7a32748b5c60445c4c7ee904caf01b91f2dbb71", GitTreeState:"clean", BuildDate:"2022-02-16T11:24:04Z", GoVersion:"go1.16.14", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.10", GitCommit:"a7a32748b5c60445c4c7ee904caf01b91f2dbb71", GitTreeState:"clean", BuildDate:"2022-02-16T11:18:16Z", GoVersion:"go1.16.14", Compiler:"gc", Platform:"linux/amd64"}
```

nginx and consul helm charts:

```
$ helm list -A (Trimmed output)
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
consul consul 1 2022-08-22 19:42:43.496703951 +0000 UTC deployed consul-0.46.1 1.12.3
nginx-stable nginx-stable 1 2022-08-03 22:33:45.242779695 +0000 UTC deployed nginx-ingress-0.14.0 2.3.0
```

consul values.yaml for helm installation:
```
global:
name: consul
ui:
ingress:
enabled: true
hosts:
- backend:
port:
name: 80
service:
name: consul-ui
host: myweb.mydomain.com
pathType: ImplementationSpecific
paths:
- /consul
ingressClassName: nginx
```

Alternate/similar command line consul install with above values (without values.yaml file):
```
helm install consul hashicorp/consul --set global.name=consul \
--create-namespace --namespace consul \
--set ui.ingress.enabled=true \
--set 'ui.ingress.hosts[0].host=myweb.mydomain.com' \
--set 'ui.ingress.hosts[0].paths[0]=/consul' \
--set 'ui.ingress.ingressClassName=nginx' \
--set 'ui.ingress.hosts[0].backend.service.name=consul-ui' \
--set 'ui.ingress.hosts[0].backend.port.name=80' \
--set 'ui.ingress.hosts[0].pathType=ImplementationSpecific'
```

Where am I going wrong?
Please help.

Contributor guide

Open the contributing guide

Research direction

Start with the consul values.yaml UI ingress block and the nginx ingress controller configuration, then compare the generated routing for /consul with the working / path using the listed Kubernetes, Consul, and chart versions. Done means the Consul UI loads at myweb.mydomain.com/consul without producing the invalid URL path error.

Written by the indexing model from the issue text.

Assessment

Tech stack
helm, kubernetes, nginx
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.