How EXTERNAL-IP is set In This Case?

470 views Asked by At

After having a local Kubernates up using minikube, I run a series of kubectl commands:

$ kubectl apply -f https://app.getambassador.io/initializer/yaml/0a6624ff-5b39-418f-b61d-7ba83dc3ab7b/crds && \
kubectl wait --for condition=established --timeout=90s crd -lproduct=aes

$ kubectl apply -f https://app.getambassador.io/initializer/yaml/0a6624ff-5b39-418f-b61d-7ba83dc3ab7b/install && \
kubectl wait -n ambassador deploy -lproduct=aes --for condition=available --timeout=90s

$ kubectl apply -f https://app.getambassador.io/initializer/yaml/0a6624ff-5b39-418f-b61d-7ba83dc3ab7b/configure

To see the Ambassador Edge Stack (Ingress and API gateway)

$ kubectl get svc --namespace ambassador
NAME               TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
ambassador         LoadBalancer   10.111.43.125   <pending>     80:30130/TCP,443:30217/TCP   8m37s
ambassador-admin   ClusterIP      10.111.152.68   <none>        8877/TCP                     8m37s
ambassador-redis   ClusterIP      10.98.170.102   <none>        6379/TCP                     8m38s

The external IP shall be localhost, but it isn't. Those commands don't specify the external IP, at least not directly. Is some sort of setting missing in this case?

This question possibly shall be addressed to Ambassador Labs (Datawire) people.

2

There are 2 answers

1
acid_fuji On

Minikube has an ambassador addon so you don`t have to deploy this like that. All you have to to is to enable it:

minikube addons enable ambassador

You can then access it with 3 ways as described in the documents:

With this you will be able to access it via external-ip. To get this you can run kubectl get service ambassador -n ambassador:

NAME         TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                      AGE
ambassador   LoadBalancer   10.106.55.39   10.106.55.39   80:31993/TCP,443:31124/TCP   24h

Note that Minikube does not natively support load balancers. Instead of minikube tunnel you might want to check also minikube service list. The output should look like this:

➜  ~ minikube service list
|-------------|-----------------------------|--------------|-------------------------|
|  NAMESPACE  |            NAME             | TARGET PORT  |           URL           |
|-------------|-----------------------------|--------------|-------------------------|
| ambassador  | ambassador                  | http/80      | http://172.17.0.3:31993 |
|             |                             | https/443    | http://172.17.0.3:31124 |
| ambassador  | ambassador-admin            | No node port |
| ambassador  | ambassador-operator-metrics | No node port |

  • Configuring it with Ingress resource which is also described here.
  • Configuring it with ambassador Mapping Resource.
3
Casey On

Normally when you create a Service of type LoadBalancer, Kubernetes automatically tries to provision an external load balancer in the cloud environment. Because Minikube does not have a built-in LoadBalancer that it can provision to the ambassador service. There are 2 ways around this.

  1. Use minikube tunnel to simulate a load balancer. Depending on your minikube version, this might be either localhost or the cluster IP of the service.

  2. Deploy Ambassador as a NodePort Service and do a kubectl port-forward so that localhost resolves to the Ambassador service.