0

I'm fiddling around with a local Kubernetes Cluster using MicroK8s for Development and potentially production after that.

I managed to get the Kubernetes-Dashboard to show up after a while (honestly new to Cloud at all) using an Ingress Controller with the following:

kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: dashboard
  namespace: kube-system
  selfLink: /apis/networking.k8s.io/v1/namespaces/kube-system/ingresses/dashboard
  uid: 71dca07a-263b-4e52-8188-00c4a89f834b
  resourceVersion: '68046'
  generation: 10
  creationTimestamp: '2022-03-27T18:56:19Z'
  annotations:
    kubernetes.io/ingress.class: public
    nginx.ingress.kubernetes.io/backend-protocol: HTTPS
  managedFields:
    - manager: dashboard
      operation: Update
      apiVersion: networking.k8s.io/v1
      time: '2022-03-27T18:56:19Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:kubernetes.io/ingress.class: {}
            f:nginx.ingress.kubernetes.io/backend-protocol: {}
        f:spec:
          f:rules: {}
    - manager: nginx-ingress-controller
      operation: Update
      apiVersion: networking.k8s.io/v1
      time: '2022-03-27T18:58:25Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:loadBalancer:
            f:ingress: {}
      subresource: status
spec:
  rules:
    - host: cube1
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: kubernetes-dashboard
                port:
                  number: 443
status:
  loadBalancer:
    ingress:
      - ip: 127.0.0.1

As soon as I'm changing path: / to anything else (ex. path: /dashboard) it just stops working, displaying a 404 - but not the nginx 404 which makes me believe there's something else wrong.

Can anyone help me troubleshoot this? I'd like to have the dashboard under /dashboard and the api via /api/v1, client via / for now.

Clustering will be dealt with later, stuff like different Ingress Controllers (Traefik/Envoy) and HTTPS/TLS as well, one step at a time.

Andy Troschke
  • 441
  • 1
  • 5
  • 13
  • Which version of Kubernetes did you use and how did you set up the cluster (your config file)? Did you use a bare metal installation or some cloud provider? It is important to reproduce your problem. – Mykola Mar 28 '22 at 09:16

1 Answers1

0

It works for me.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: dashboard
  namespace: kubernetes-dashboard
  annotations:
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  ingressClassName: nginx
  rules:
  - http:
      paths:
      - path: /dashboard(/|$)(.*)
        pathType: Prefix
        backend:
          service:
            name: kubernetes-dashboard
            port:
              number: 443
ymfan
  • 1