# Microk8s: how to get the node external-ip, like "minikube ip"?

**URL:** <https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974>\
**Category:** microk8s\
**Created:** [May 18, 2020, 4:38pm UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974 "2020-05-18T16:38:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TristanStanic](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tristanstanic/32/5148_2.png) [@TristanStanic](https://discuss.kubernetes.io/u/TristanStanic)\
**Post date:** [May 18, 2020, 4:38pm UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/1 "2020-05-18T16:38:00Z")

</div>

Using microk8s 1.18 on Ubuntu 20.04.

I’d like to get the external ip of the node. Similar to `minikube ip` as shown in the [Istio Ingress Gateways](https://istio.io/docs/tasks/traffic-management/ingress/ingress-control/#determining-the-ingress-ip-and-ports) documentation.

**Question** : How to get the IP address of the node so to allow remote clients outside of the cluster to access services installed within the cluster? In my example, this address would be `192.168.1.98`. Maybe it is possible to grep it from `microk8s.kubectl cluster-info`  
However all I can see is the loopback IP `127.0.0.1`.

```auto
$ microk8s.kubectl cluster-info

Kubernetes master is running at https://127.0.0.1:16443
Heapster is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/heapster/proxy
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Grafana is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
InfluxDB is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/monitoring-influxdb:http/proxy

```

EDIT: Hum maybe I am asking the wrong question? A cluster theoritically has multiple nodes so it’s kind of illogical to ask the cluster to give a node IP address. Maybe I should query the node details and read the info in the `Addresses` section:

```auto
$ microk8s.kubectl describe node $(microk8s.kubectl get nodes --no-headers | cut -f 1 -d " ")

// console output:
Name: myhostname
Roles: <none>
... etc ...
Addresses:
  InternalIP: 192.168.1.98
  Hostname: myhostname
... etc ...

```

---

<div class="post-metadata">

**Author:** ![kjackal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/kjackal/32/1750_2.png) [@kjackal](https://discuss.kubernetes.io/u/kjackal)\
**Post date:** [May 19, 2020, 6:44am UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/2 "2020-05-19T06:44:19Z")

</div>

MicroK8s will use the default interface. You should be able to locate that with `ip route | grep default`.  
You are right that in a MIcroK8s cluster you will get one IP per node.

In case you look for a kubeconfig file to access the api server, you can use `microk8s config` [1]

[1] [https://microk8s.io/docs/commands#microk8s-config](https://microk8s.io/docs/commands#microk8s-config)

---

<div class="post-metadata">

**Author:** ![TristanStanic](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tristanstanic/32/5148_2.png) [@TristanStanic](https://discuss.kubernetes.io/u/TristanStanic)\
**Post date:** [May 20, 2020, 4:30pm UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/3 "2020-05-20T16:30:58Z")

</div>

> [@kjackal](#):
>
> ip route | grep default

This command returns the IP address of the router, not the IP of the machine where microk8s is installed. Can you please clarify?

---

<div class="post-metadata">

**Author:** ![kjackal](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/kjackal/32/1750_2.png) [@kjackal](https://discuss.kubernetes.io/u/kjackal)\
**Post date:** [May 20, 2020, 4:48pm UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/4 "2020-05-20T16:48:16Z")

</div>

With `ip route | grep default` you will get the interface used by MicroK8s. You can do an `ifconfig` of that interface to see more info.

---

<div class="post-metadata">

**Author:** ![TristanStanic](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/tristanstanic/32/5148_2.png) [@TristanStanic](https://discuss.kubernetes.io/u/TristanStanic)\
**Post date:** [May 20, 2020, 4:51pm UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/5 "2020-05-20T16:51:34Z")

</div>

Oh Ok thanks. I did directly `ifconfig`. But found the output of `kubectl describe node` more informative (details in initial post).

---

<div class="post-metadata">

**Author:** ![sguidos](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@sguidos](https://discuss.kubernetes.io/u/sguidos)\
**Post date:** [January 11, 2021, 8:14pm UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/6 "2021-01-11T20:14:09Z")

</div>

An easy way to see the IP address of the node is to use the `get nodes` command with “wide” output; the INTERNAL-IP column contains the IP of the node:

```auto
microk8s kubectl get nodes -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
microk8s-vm Ready <none> 35m v1.18.13 172.27.13.35 <none> Ubuntu 18.04.5 LTS 4.15.0-130-generic containerd://1.2.5

```

---

<div class="post-metadata">

**Author:** ![linde](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/linde/32/7807_2.png) [@linde](https://discuss.kubernetes.io/u/linde)\
**Post date:** [June 7, 2021, 5:39am UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/7 "2021-06-07T05:39:07Z")

</div>

i just happened to need to do this and came to the following and thought it might be helpful to share:

```bash
microk8s kubectl get node -o json | jq '.items[].status.addresses[] | select(.type=="InternalIP") | .address'

```

---

<div class="post-metadata">

**Author:** ![SamD](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/samd/32/9958_2.png) [@SamD](https://discuss.kubernetes.io/u/SamD)\
**Post date:** [April 28, 2022, 6:18am UTC](https://discuss.kubernetes.io/t/microk8s-how-to-get-the-node-external-ip-like-minikube-ip/10974/8 "2022-04-28T06:18:46Z")

</div>

Looks as if at the time of writing this things perhaps have changed a bit with later microk8s versions, `ifconfig -a` reveals virtual nic vxlan.calico and that ip I’m guessing is the one we want to be using ? I’m not all that familiar with calico but using the command mentioned by @TristanStanic `microk8s.kubectl describe node $(microk8s.kubectl get nodes --no-headers | cut -f 1 -d " ")` I see the same address on an annotation labelled `projectcalico.org/IPv4VXLANTunnelAddr`
