Knative: confusing service names and routing

10/8/2019

I’m getting started with Kubernetes, Knative and Gloo. My goal is to deploy a simple http service to a gke cluster. I’ve managed to setup knative, gloo and deploy a healthy service there named backend. Next step is to setup routing /api/v1 -> backend. I’ve created a virtualservice named public-api, now I need to add a route. According to docs, I need to run

glooctl add route \
    --path-exact /api/v1 \
    --dest-name ???dest-name??? \
    --prefix-rewrite /

And I’m confused. I suppose this would be easier if I just installed plain gloo on plain gke. But with Knative I see four upstreams:

| mb-backend-bdtr2-4tdfq-9090                             | Kubernetes | Accepted | svc name:                      |
|                                                         |            |          | backend-bdtr2-4tdfq            |
|                                                         |            |          | svc namespace: mb              |
|                                                         |            |          | port:          9090            |
|                                                         |            |          |                                |
| mb-backend-bdtr2-4tdfq-9091                             | Kubernetes | Accepted | svc name:                      |
|                                                         |            |          | backend-bdtr2-4tdfq            |
|                                                         |            |          | svc namespace: mb              |
|                                                         |            |          | port:          9091            |
|                                                         |            |          |                                |
| mb-backend-bdtr2-80                                     | Kubernetes | Accepted | svc name:      backend-bdtr2   |
|                                                         |            |          | svc namespace: mb              |
|                                                         |            |          | port:          80              |
|                                                         |            |          |                                |
| mb-backend-bdtr2-zz6t9-80                               | Kubernetes | Accepted | svc name:                      |
|                                                         |            |          | backend-bdtr2-zz6t9            |
|                                                         |            |          | svc namespace: mb              |
|                                                         |            |          | port:          80              |

I have four questions:

  1. which one to use? mb-backend-bdtr2-80 or mb-backend-bdtr2-zz6t9-80
  2. why do I have two upstreams with port 80?
  3. what are these upstreams with ports 9090 and 9091?
  4. how can I define more descriptive names? Gloo’s system upstreams are named nicer without any postfix.
-- Andrey Kuznetsov
gloo
knative
kubernetes

1 Answer

10/8/2019

Thanks to great community help on solo.io slack, I've got answers.

  1. I should route to backend-bdtr2. This value can be obtained by running kubectl get proxy -n gloo-system knative-external-proxy -oyaml.
  2. Two upstreams with 80 port are Knative's placeholder services routing to the original backend service. They will dynamically route to the knative activator when the service needs to be scaled up. Apparently the one upstream is for external and the second is for internal routing (but not sure for now).
  3. Upstreams with ports 9090 and 9091 are knative sidecars.
  4. Names are generated by knative and apparently there is no solution to have descriptive postfix for them right now.
-- Andrey Kuznetsov
Source: StackOverflow