Juju K8S charm expose


#1

What is juju expose supposed to do in the k8s charms?

I see thats what you do with juju-external-hostname, so I tried that on my own charm but I can hit its internal IP but don’t see what its supposed to do to route externally.

juju config solr2 juju-external-hostname=51.68.206.78.xip.io for example, but if I run

curl -L -vvv 10.152.183.25:8983

on the worker I get my webpage

but

curl -L -vvv 51.68.206.7:8983
or
curl -L -vvv 51.68.206.7.xip.io:8983

I don’t get anything


#2

Ah I found the advanced page

 juju deploy cs:~spiculecharms/solr-k8s --storage cores=k8s-pool,10M --config kubernetes-service-type=LoadBalancer solr2

Works for me with a MetalLb, cool stuff.


#3

The expose semantic on k8s is not as straightforward as for cloud deployments, where all it needs to do is open ports in a firewall. As you have seen, on some substrates, a load balancer works but needs to be configured that way at deployment time. On other substrates where a load balancer with a public IP address might not be supported, an Ingress Resource is used to route http traffic via the cluster’s ingress controller to the service. This is what juju expose currently does when run.