ajeckmans / TeslaMateOnK8s

How-to for installing TeslaMate in an Azure cluster
3 stars 1 forks source link

Trying to customise hostname #2

Open instantdreams opened 3 years ago

instantdreams commented 3 years ago

This time I'm trying to have multiple k8s clusters, one per vehicle. To manage this I'm trying to customise my hostnames. This has worked, and I am SO close, but I have this issue:

> kubectl describe ing dashboard-ingress -n ingress-basic
Name:             dashboard-ingress
Namespace:        ingress-basic
Address:          [ip address]
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
  tls-secret terminates [teslamate].[hostname],[grafana].[hostname]
Rules:
  Host                                  Path  Backends
  ----                                  ----  --------
  [teslamate].[hostname]
                                        /   teslamate:4000 (<error: endpoints "teslamate" not found>)
  [grafana].[hostname]
                                        /   grafana:3001 (<error: endpoints "grafana" not found>)
Annotations:                            cert-manager.io/cluster-issuer: letsencrypt
                                        kubernetes.io/ingress.class: nginx
                                        nginx.ingress.kubernetes.io/auth-signin: https://[auth].[hostname]/oauth2/start?rd=https%3A%2F%2F$host$request_uri
                                        nginx.ingress.kubernetes.io/auth-url: https://[auth].[hostname]/oauth2/auth
Events:                                 <none>

The [teslamate], [grafana], [auth], and [hostname] are replaced by my values, but what is causing this issue? Everything appears to be installed correctly:

> kubectl get svc --all-namespaces
NAMESPACE       NAME                                       TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                      AGE
default         cm-acme-http-solver-twtbg                  NodePort       10.0.102.237   <none>         8089:31723/TCP               72m
default         grafana                                    ClusterIP      10.0.172.48    <none>         3001/TCP                     71m
default         kubernetes                                 ClusterIP      10.0.0.1       <none>         443/TCP                      97m
default         oauth2-proxy                               ClusterIP      10.0.161.135   <none>         80/TCP                       72m
default         teslamate                                  ClusterIP      10.0.203.215   <none>         4000/TCP                     71m
default         teslamate-postgresql                       ClusterIP      10.0.108.206   <none>         5432/TCP                     71m
default         teslamate-postgresql-headless              ClusterIP      None           <none>         5432/TCP                     71m
ingress-basic   cert-manager                               ClusterIP      10.0.202.207   <none>         9402/TCP                     73m
ingress-basic   cert-manager-webhook                       ClusterIP      10.0.192.213   <none>         443/TCP                      73m
ingress-basic   nginx-ingress-nginx-controller             LoadBalancer   10.0.249.55    20.63.25.156   80:31206/TCP,443:32698/TCP   75m
ingress-basic   nginx-ingress-nginx-controller-admission   ClusterIP      10.0.33.34     <none>         443/TCP                      75m
kube-system     dashboard-metrics-scraper                  ClusterIP      10.0.5.104     <none>         8000/TCP                     97m
kube-system     healthmodel-replicaset-service             ClusterIP      10.0.159.24    <none>         25227/TCP                    97m
kube-system     kube-dns                                   ClusterIP      10.0.0.10      <none>         53/UDP,53/TCP                97m
kube-system     kubernetes-dashboard                       ClusterIP      10.0.61.126    <none>         443/TCP                      97m
kube-system     metrics-server                             ClusterIP      10.0.84.3      <none>         443/TCP                      97m

Any suggestions you might have are most welcome!

ajeckmans commented 3 years ago

Move the ingress controller and config into the default namespace. It is trying to find the services in its own namespace.

Also depending on what you actually want to achieve, you can create multiple completely separate installs of teslamate by installing each into its own namespace with its own ingress config with the proper hostnames.

instantdreams commented 3 years ago

Your idea of using multiple installed in each namespace sounds like the perfect approach.

Here's what happened once I used the same namespace for everything:

> kubectl describe ing dashboard-ingress -n obsidian
Name:             dashboard-ingress
Namespace:        obsidian
Address:          [ip address]
Default backend:  default-http-backend:80 (<error: endpoints "default-http-backend" not found>)
TLS:
  tls-secret terminates obsidian-teslamate.[hostname],obsidian.[hostname]
Rules:
  Host                                  Path  Backends
  ----                                  ----  --------
  obsidian-teslamate.[hostname]
                                        /   teslamate:4000 (10.244.2.10:4000)
  obsidian.[hostname]
                                        /   grafana:3001 (10.244.2.11:3000)
Annotations:                            cert-manager.io/cluster-issuer: letsencrypt
                                        kubernetes.io/ingress.class: nginx
                                        nginx.ingress.kubernetes.io/auth-signin: https://obsidian-auth.[hostname]/oauth2/start?rd=https%3A%2F%2F$host$request_uri
                                        nginx.ingress.kubernetes.io/auth-url: https://obsidian-auth.[hostname]/oauth2/auth
Events:
  Type    Reason             Age   From                      Message
  ----    ------             ----  ----                      -------
  Normal  CREATE             17m   nginx-ingress-controller  Ingress obsidian/dashboard-ingress
  Normal  CreateCertificate  17m   cert-manager              Successfully created Certificate "tls-secret"
  Normal  UPDATE             17m   nginx-ingress-controller  Ingress obsidian/dashboard-ingress

All the services appear to be working nicely:

> kubectl get svc --all-namespaces
NAMESPACE     NAME                                       TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)
default       kubernetes                                 ClusterIP      10.0.0.1       <none>         443/TCP
kube-system   dashboard-metrics-scraper                  ClusterIP      10.0.179.61    <none>         8000/TCP
kube-system   healthmodel-replicaset-service             ClusterIP      10.0.86.205    <none>         25227/TCP
kube-system   kube-dns                                   ClusterIP      10.0.0.10      <none>         53/UDP,53/TCP
kube-system   kubernetes-dashboard                       ClusterIP      10.0.188.178   <none>         443/TCP
kube-system   metrics-server                             ClusterIP      10.0.77.228    <none>         443/TCP
obsidian      cert-manager                               ClusterIP      10.0.33.195    <none>         9402/TCP
obsidian      cert-manager-webhook                       ClusterIP      10.0.28.222    <none>         443/TCP
obsidian      cm-acme-http-solver-jktsc                  NodePort       10.0.127.201   <none>         8089:30371/TCP
obsidian      grafana                                    ClusterIP      10.0.16.235    <none>         3001/TCP
obsidian      nginx-ingress-nginx-controller             LoadBalancer   10.0.145.228   20.63.17.161   80:31533/TCP,443:32607/TCP
obsidian      nginx-ingress-nginx-controller-admission   ClusterIP      10.0.100.35    <none>         443/TCP
obsidian      oauth2-proxy                               ClusterIP      10.0.143.100   <none>         80/TCP
obsidian      teslamate                                  ClusterIP      10.0.121.93    <none>         4000/TCP
obsidian      teslamate-postgresql                       ClusterIP      10.0.242.53    <none>         5432/TCP
obsidian      teslamate-postgresql-headless              ClusterIP      None           <none>         5432/TCP

These two URIs give a 500 Internal Server error:

This URI gives a "server IP address not known" (because there's no A record, but the instructions didn't mention to create one)

Any suggestions as to why they're returning 500?

ajeckmans commented 3 years ago

I'm sorry for never responding to this issue. Did you succeed in the end? Or are you still experiencing the same issue?