简体   繁体   中英

k3s, traefik, awx-operator and ingress

I have a three node, on-prem, k3 cluster. I have installed AWX per these instructions: https://github.com/ansible/awx-operator

I can access the AWX login screen by executing this command on my laptop:

[red@mac.local ~]$ kubectl -n kube-system port-forward deployment/traefik 7080
Forwarding from 127.0.0.1:7080 -> 8052
Forwarding from [::1]:7080 -> 8052
Handling connection for 7080
...

And I can point my browser to http://localhost:7080 and I see the AWX login screen. But I haven't a clue how to set up an ingress for AWX. What have I tried? A whole bunch of things and none of those have worked.

My latest attempt to create a ingress used this yaml:

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: awx-demo-ingress
  # namespace: awx

spec:
  rules:
    - host: rocky
      http:
        paths:
          - path: /awx
            pathType: Exact
            backend:
              service:
                name:  awx-demo-service
                port:
                  number: 80

This creates an ingress...

kube-system   awx-demo-ingress   traefik   localhost   10.0.3.51,10.0.3.52,10.0.3.53   80      12m

But rocky does not resolve to any IP address and if I point my browsers to http://10.0.3.51/ or http://10.0.3.51/awx results in 404 error.

I am close but I still got something wrong...

$ kubectl describe ingress awx-demo-ingress -n kube-system
Name:             awx-demo-ingress
Labels:           <none>
Namespace:        kube-system
Address:          10.0.3.51,10.0.3.52,10.0.3.53
Ingress Class:    traefik
Default backend:  <default>
Rules:
  Host                         Path  Backends
  ----                         ----  --------
  rocky-k3-1.XXXXXXXXX.com
                               /login   awx-demo-service:80 (<error: endpoints "awx-demo-service" not found>)
Annotations:                   <none>
Events:                        <none>

I also tried this...

---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: awx-demo-ingress
  namespace: awx

spec:
  rules:
    - host: rocky-k3-1.XXXXXXXX.com
      http:
        paths:
          - path: /login
            pathType: Exact
            backend:
              service:
                name:  awx-demo-service
                port:
                  number: 80

$ kubectl describe ingress awx-demo-ingress
Name:             awx-demo-ingress
Labels:           <none>
Namespace:        awx
Address:          10.0.3.51,10.0.3.52,10.0.3.53
Ingress Class:    traefik
Default backend:  <default>
Rules:
  Host                         Path  Backends
  ----                         ----  --------
  rocky-k3-1.XXXXXXXXXX.com
                               /login   awx-demo-service:80 (10.42.1.9:8052)
Annotations:                   <none>
Events:                        <none>

But if I do a curl like this...

$ curl http://rocky-k3-1.XXXXXXXX.com/login/
404 page not found

... I get 404 errors.

It turned out that I was using the wrong path in my ingress.yml file.

          - path: /login

needed to change to

          - path: /

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM