Juju K8s charms: How to get LoadBalancer External IP


#1

I’m using a k8s charm with the following metadata:

deployment:
  type: stateful
  service: loadbalancer

I have two questions:

  • How should I get the External IP
  • How should I send the External IP

How should I get the External IP

Currently, if I execute juju status, I’m not getting any External IP for the charm (nbi-k8s)

$ juju status nbi-k8s
Model  Controller           Cloud/Region         Version  SLA          Timestamp
osm    k8s-cloud-us-east-1  k8s-cloud/us-east-1  2.6.6    unsupported  17:48:32+02:00

App      Version  Status  Scale  Charm    Store  Rev  OS          Address  Notes
nbi-k8s           active      3  nbi-k8s  local    3  kubernetes           

Unit        Workload  Agent  Address     Ports     Message
nbi-k8s/6   active    idle   10.1.57.20  9999/TCP  configured
nbi-k8s/7   active    idle   10.1.15.13  9999/TCP  configured
nbi-k8s/8*  active    idle   10.1.69.29  9999/TCP  configured

I need to execute the following command to get the External IP of the service:

$ kubectl get -n osm svc nbi-k8s
NAME      TYPE           CLUSTER-IP       EXTERNAL-IP                                                              PORT(S)          AGE
nbi-k8s   LoadBalancer   10.152.183.192   af2...823.us-east-1.elb.amazonaws.com   9999:31803/TCP   107m

I think we should be able to get that value with a juju command.

How should I send the External IP

Also, I don’t know how to get that External IP from the charm in order to send it through a relation. Until now, I’ve been using a clusterIP type service. But when changing it to loadbalancer, I’m getting this error:

  No ingress-addresses: {'bind-addresses': [{'macaddress': '', 'interfacename': '', 'addresses': []}]}