<p>I have created a pod using kubectl.</p>

<p>I want to connect to the endpoint of this pod. How to do that using kubectl? </p>

<p>You can do port forward to access the pod from your local system</p>

<pre><code>kubectl port-forward pods/redis-master-765d459796-258hz 7000:6379
</code></pre>

<p><a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/</a></p>

<p>Or You can get a shell in the running container</p>

<pre><code>kubectl exec -it pods/shell-demo -- /bin/bash
</code></pre>

<p><a href="https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/</a></p>
