<p>I am trying to send a curl request to a Kubernetes ClusterType service. Is there any way to perform curl requests to service?</p>
<p>I am deploying an application with Blue/Green deployment. So here need to verify the Blue version is properly working or not. So decide to send a curl request to the blue version. When I get 200 status, I will route all traffic to this version.</p>
<p>But now am facing that send curl request to the new version(Blue version) of the application.</p>

Amjed saleel
<p>ClusterIP makes the Service only reachable from within the cluster. This is the default ServiceType. You can read more information about services <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">here</a>.</p>
<p>As the command in the first answer doesn't work, I'm posting the working solution:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl run tmp-name --rm --image nginx -i --restart=Never -- /bin/bash -c 'curl -s clusterip:port'
</code></pre>
<p>with the above command curl is working fine. You can use a service name instead of cluster IP address.</p>
<p><code>--restart=Never</code> is needed for using curl like this.</p>
<p><code>--rm</code> ensures the Pod is deleted when the shell exits.</p>
<h5>Edited:</h5>
<h3>But if you want to access your ClusterIp service from the host on which you run kubectl, you can use Port Forwarding.</h3>
<pre class="lang-sh prettyprint-override"><code>kubectl port-forward service/yourClusterIpServiceName 28015:yourClusterIpPort
</code></pre>
<p>You will get output like this:</p>
<pre class="lang-yaml prettyprint-override"><code>Forwarding from 127.0.0.1:28015 -&gt; yourClusterIpPort
Forwarding from [::1]:28015 -&gt; yourClusterIpPort
</code></pre>
<p>after that you will be able to reach your ClusterIP service using this command:</p>
<pre class="lang-sh prettyprint-override"><code>curl localhost:28015
</code></pre>
<p>More information about port forwarding is on <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/" rel="nofollow noreferrer">the official documentation page</a>.</p>
