<p>I am trying to access a clusterip service (running kubernetes on my laptop through docker-for-mac).</p>

<p>Following the <a href="https://hackernoon.com/getting-started-with-microservices-and-kubernetes-76354312b556" rel="nofollow noreferrer">instructions here</a>, I was able to successfully ping the service like this:</p>

<pre><code>kubectl run curl --image=radial/busyboxplus:curl -i --tty
curl -v http://10.106.1.204:8000/api/v0.1/predictions -d '{"foo": "bar"}' -H "Content-Type: application/json"
</code></pre>

<p>but I can't get it to work using the service name instead of it's ip. I then tried to use kubectl proxy <a href="https://medium.com/google-cloud/kubernetes-nodeport-vs-loadbalancer-vs-ingress-when-should-i-use-what-922f010849e0" rel="nofollow noreferrer">as described here</a>, but I can't get it to work:</p>

<pre><code>kubectl proxy --port=8080 &amp;
curl -v http://127.0.0.1:8080/api/v1/proxy/namespaces/deploy-test/services/10.106.1.204:8000/api/v0.1/predictions
</code></pre>

<p>that gives me a 404 error as do all of the following:</p>

<pre><code>curl -v http://127.0.0.1:8080/api/v1/proxy/namespaces/deploy-test/services/10.106.1.204:8000
curl -v http://127.0.0.1:8080/api/v1/proxy/namespaces/deploy-test/services/10.106.1.204:8000/predictions
curl -v http://127.0.0.1:8080/api/v1/proxy/namespaces/deploy-test/services/10.106.1.204:8000/api/v0.1/predictions
</code></pre>

<p>as well as all combinations of replacing <code>8000</code> with <code>http</code> in all of the above and/or the ip with the service name.</p>

<p>I can confirm that the proxy is working as <code>http://127.0.0.1:8080/api/v1/namespaces/deploy-test/pods</code> works.</p>

<p>This is the description of the service. Note that I am specifically trying to access it via the clusterip and not use Ambassador.</p>

<pre><code>kubectl describe svc -n deploy-test template-product-app-seldon-prediction-service
Name:              template-product-app-seldon-prediction-service
Namespace:         deploy-test
Labels:            seldon-app=template-product-app-seldon-prediction-service
                   seldon-deployment-id=template-product-app-seldon-prediction-service
Annotations:       getambassador.io/config:
                     ---
                     apiVersion: ambassador/v1
                     kind: Mapping
                     name: seldon_deploy-test_seldon-prediction-service_rest_mapping
                     prefix: /seldon/deploy-test/seldon-prediction-service/
                     service: template-product-app-seldon-prediction-service.deploy-test:8000
                     timeout_ms: 3000
                     ---
                     apiVersion: ambassador/v1
                     kind: Mapping
                     name: seldon_deploy-test_seldon-prediction-service_grpc_mapping
                     grpc: true
                     prefix: /seldon.protos.Seldon/
                     rewrite: /seldon.protos.Seldon/
                     service: template-product-app-seldon-prediction-service.deploy-test:5001
                     timeout_ms: 3000
                     headers:
                       namespace: deploy-test
                       seldon: seldon-prediction-service
                     retry_policy:
                       retry_on: connect-failure
                       num_retries: 3
Selector:          seldon-app=template-product-app-seldon-prediction-service
Type:              ClusterIP
IP:                10.106.1.204
Port:              http  8000/TCP
TargetPort:        8000/TCP
Endpoints:         10.1.1.4:8000
Port:              grpc  5001/TCP
TargetPort:        5001/TCP
Endpoints:         10.1.1.4:5001
Session Affinity:  None
Events:            &lt;none&gt;
</code></pre>

<p>Any suggestions on how to do this via <code>kubectl proxy</code> instead of spinning up a pod with <code>radial/busyboxplus:curl</code>?</p>

Dan
<p>The general format to access http services through the kubectl proxy is the following:</p>

<pre><code>http://api.host/api/v1/namespaces/NAMESPACE/services/SERVICE_NAME:SERVICE_PORT/proxy/
</code></pre>

<p>In your case you added the cluster ip which is not necessary. 
Try:</p>

<pre><code>http://127.0.0.1:8080/api/v1/namespaces/deploy-test/services/template-product-app-seldon-prediction-service:8000/proxy/api/v0.1/predictions
</code></pre>

<p><a href="http://127.0.0.1:43029/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard" rel="noreferrer">http://127.0.0.1:43029/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard</a></p>

<p>Note that this will probably not work with grpc, only for http. (Use a NodePort oder LoadBalancer instead in that case)</p>
