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=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

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.

1 Like

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.

One question! Can juju expose k8s charms to the 443 port? I’ve seen kubernetes ingress service has support for it.

I have not tried it but if it doesn’t work, it’s something we need to fix. So feel free to file a bug if needed if you have any issues.