Juju K8S charm expose


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= for example, but if I run

curl -L -vvv

on the worker I get my webpage


curl -L -vvv
curl -L -vvv

I don’t get anything


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.


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.