jcmoraisjr / haproxy-ingress

HAProxy Ingress

Home Page:https://haproxy-ingress.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ingress Getting-Started installation won't expose external-ip on microk8s default single-node install

mcordova1967 opened this issue · comments

Description of the problem

Ingress controller haproxy-ingress never receives external IP on microk8s single-node cluster:

NAME                      TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/haproxy-ingress   LoadBalancer   10.152.183.69   <pending>     80:30636/TCP,443:32069/TCP   25m

I installed HAProxy ingress v0.14 on MicroK8s v1.26.0 revision 4390 with default add-ons + dns, metrics-server and hostpath-storage:

microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    dns                  # (core) CoreDNS
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    storage              # (core) Alias to hostpath-storage add-on, deprecated

My hostname is test.mshome.net (a multipass VM ubuntu 22.04 running on Windows)

I deployed the echo service ingress with:

kubectl --namespace default create ingress echoserver  --annotation kubernetes.io/ingress.class=haproxy  --rule="test.mshome.net/*=echoserver:8080"

When testing de deployed echo service, I receive a 404 not found:

curl -k https://test.mshome.net/
<html><body><h1>404 Not Found</h1>
The requested URL was not found.
</body></html>

Expected behavior

I expected the regular echo output

Steps to reproduce the problem

  1. On a clean VM install microk8s with default add-ons, no ingress. no load balancer
  2. Follow installation for latest HAProxy ingress version according to this URL
    https://haproxy-ingress.github.io/docs/getting-started/
  3. Test deployed HAProxy with kubectl get all -n ingress-controller
  4. Test deployed echo service with curl

Environment information

HAProxy Ingress version: v0.xx
0.14

kubectl get all -A

k get all -A
NAMESPACE            NAME                                           READY   STATUS    RESTARTS   AGE
kube-system          pod/calico-kube-controllers-7c48f55596-6w4hc   1/1     Running   0          37m
kube-system          pod/calico-node-h5vx5                          1/1     Running   0          37m
kube-system          pod/metrics-server-6f754f88d-cx7wh             1/1     Running   0          34m
kube-system          pod/hostpath-provisioner-69cd9ff5b8-hmgkw      1/1     Running   0          33m
kube-system          pod/coredns-6f5f9b5d74-ttcn9                   1/1     Running   0          33m
ingress-controller   pod/haproxy-ingress-667c7fbbf-jlbht            1/1     Running   0          17m
default              pod/echoserver-54789848c4-plgd4                1/1     Running   0          3m28s

NAMESPACE            NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
default              service/kubernetes        ClusterIP      10.152.183.1     <none>        443/TCP                      37m
kube-system          service/metrics-server    ClusterIP      10.152.183.253   <none>        443/TCP                      34m
kube-system          service/kube-dns          ClusterIP      10.152.183.10    <none>        53/UDP,53/TCP,9153/TCP       34m
ingress-controller   service/haproxy-ingress   LoadBalancer   10.152.183.69    <pending>     80:30636/TCP,443:32069/TCP   17m
default              service/echoserver        ClusterIP      10.152.183.118   <none>        8080/TCP                     3m9s

NAMESPACE     NAME                         DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-system   daemonset.apps/calico-node   1         1         1       1            1           kubernetes.io/os=linux   37m

NAMESPACE            NAME                                      READY   UP-TO-DATE   AVAILABLE   AGE
kube-system          deployment.apps/calico-kube-controllers   1/1     1            1           37m
kube-system          deployment.apps/metrics-server            1/1     1            1           34m
kube-system          deployment.apps/hostpath-provisioner      1/1     1            1           34m
kube-system          deployment.apps/coredns                   1/1     1            1           34m
ingress-controller   deployment.apps/haproxy-ingress           1/1     1            1           17m
default              deployment.apps/echoserver                1/1     1            1           3m28s

NAMESPACE            NAME                                                 DESIRED   CURRENT   READY   AGE
kube-system          replicaset.apps/calico-kube-controllers-79568db7f8   0         0         0       37m
kube-system          replicaset.apps/calico-kube-controllers-7c48f55596   1         1         1       37m
kube-system          replicaset.apps/metrics-server-6f754f88d             1         1         1       34m
kube-system          replicaset.apps/hostpath-provisioner-69cd9ff5b8      1         1         1       33m
kube-system          replicaset.apps/coredns-6f5f9b5d74                   1         1         1       33m
ingress-controller   replicaset.apps/haproxy-ingress-667c7fbbf            1         1         1       17m
default              replicaset.apps/echoserver-54789848c4                1         1         1       3m28s

Command-line options:

helm install haproxy-ingress haproxy-ingress/haproxy-ingress\
  --create-namespace --namespace ingress-controller\
  --version 0.14.0\
  -f haproxy-ingress-values.yaml

Global options:

haproxy-ingress-values.yaml:
controller:
  hostNetwork: true

Ingress objects:

kubectl get all -n ingress-controller
NAME                                  READY   STATUS    RESTARTS   AGE
pod/haproxy-ingress-667c7fbbf-jlbht   1/1     Running   0          25m

NAME                      TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
service/haproxy-ingress   LoadBalancer   10.152.183.69   <pending>     80:30636/TCP,443:32069/TCP   25m

NAME                              READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/haproxy-ingress   1/1     1            1           25m

NAME                                        DESIRED   CURRENT   READY   AGE
replicaset.apps/haproxy-ingress-667c7fbbf   1         1         1       25m

Interesting, that was fixed on v0.13 branch but not merged to master, so v0.14 release brought that bug again. Thanks for reporting. Fixed on all branches now. Closing.

@jcmoraisjr I just did a clean install on MicroK8s using 0.14 following the same instructions and there is no public IP assigned.

sudo snap install microk8s --classic

haproxy-ingress-values.yaml:
controller:
  hostNetwork: true

sudo microk8s helm install haproxy-ingress haproxy-ingress/haproxy-ingress\
  --create-namespace --namespace ingress-controller\
  --version 0.14.0\
  -f haproxy-ingress-values.yaml

The result:

NAMESPACE            NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
default              service/kubernetes        ClusterIP      10.152.183.1     <none>        443/TCP                      5h41m
ingress-controller   service/haproxy-ingress   LoadBalancer   10.152.183.132   <pending>     80:32039/TCP,443:31855/TCP   5h40m

Is that the right content for haproxy-ingress-values.yaml? just those 2 lines?

Ow sorry about the partial feedback, in fact what was fixed was the 404 error when trying to query the echoserver service, it was missing a tls configuration in the ingress resource, the getting started steps now include the correct configuration.

Regarding the values file it depends on your needs. Those two lines are just an example, they might even be wrong for your needs, and the getting started page has also the tips and the helm chart documentation.

Regarding external IP it depends on your k8s deployment, you need to run a service that watches load balancer services and creates the external IP for you. Neither ingress controller nor the chart can help you on that.

@jcmoraisjr if i have a haproxy loadbalancer running on on premise K8s load balancer node say with ip 192.168.4.55 , can i assign this to haproxy ingress controller load balancer service?

externalIPs:
  - 192.168.4.55

If yes, what should my frontend, backend rules of on premise haproxy loadbalancer contain so that traffic is routed to correct ingress resource?

A fronting haproxy which isn't the ingress one? I think you should instead configure this haproxy to route request to the ingress nodes, and configure your dns service to point to 192.168.4.45. How to expose the ingress service is a matter of where your fronting haproxy is in the network. Maybe some familiarity with k8s networking model would be of some help, have a look on articles and docs to get more familiarized to it.

@jcmoraisjr what do you mean by ingress nodes?
Actually i have an on premise kubernetes cluster setup with 2 worker and 2 master nodes. The problem is no where in any Kubernetes documentation i can get and understand that how to setup ingress controller on an on premise kubernetes cluster with an on premise k8s load balancer, and how to configure frontend, backend rules for that load balancer to direct incoming traffic to appropriate ingress resource.
can you share some documentation so that i may understand?