<p>I am running an application with GKE. It works fine but I can not figure out how to get the external IP of the service in a machine readable format.
So i am searching a gcloud or kubectl command that gives me only the external IP or a url of the format <code>http://192.168.0.2:80</code> so that I can cut out the IP.</p>

<p>You can use the <a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">jsonpath</a> output type to get the data directly without needing the additional <code>jq</code> to process the json:</p>
<pre class="lang-bash prettyprint-override"><code>kubectl get services \
   --namespace ingress-nginx \
   nginx-ingress-controller \
   --output jsonpath='{.status.loadBalancer.ingress[0].ip}'
</code></pre>
<h4>NOTE</h4>
<p>Be sure to replace the namespace and service name, respectively, with yours.</p>
