<p><strong>Objective</strong></p>

<p>I want to access the redis database in kubernetes, from a function inside ibm functions using javascript.</p>

<p><strong>Question</strong></p>

<p>How do I get the right URI, when redis is running on a Pod in Kubernetes?</p>

<p><strong>Situation</strong></p>

<p>I used this sample to setup the redis database in kubernetes <a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/#creating-a-pod-to-run-a-redis-server" rel="nofollow noreferrer">This is the link to the sample in Kubernetes</a>
I run Kuberentes inside IBM Cloud.</p>

<p><strong>Findings</strong></p>

<p>I was not able to find a answer to my question on the <a href="https://redis.io/documentation" rel="nofollow noreferrer">redis documentation</a> </p>

<p>As far as I understand by default no password configured.
Is this assumption right?</p>

<pre><code>redis://[USER]:[PASSWORD]@[CLUSTER-PUBLIC-IP]:[PORT]
</code></pre>

<p>Thanks for help ... I know this is maybe a to simple question, but currently I do not see the tree in the woods ;-)</p>

<blockquote>
  <p>As far as I understand by default no password configured.</p>
</blockquote>

<p>Yes, there is no default password in that image with Redis, you are right.</p>

<p>If you following the instruction you mentioned, you will use a <code>kubectl proxy</code>, which will forward port of your Redis in cluster to your local machine by call <code>kubectl port-forward redis-master 6379:6379</code>.</p>

<p>So in that case, Redis will be available on <code>redis://localhost:6379</code> on your PC.</p>

<p>If you want to make it available directly from ouside of the cluster, you need to create <a href="https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport" rel="noreferrer">Service with NodePort</a>, <a href="https://kubernetes.io/docs/concepts/services-networking/service/#type-loadbalancer" rel="noreferrer">Service with LoadBalancer</a> (if you in Cloud) or simply <a href="https://kubernetes.io/docs/concepts/services-networking/service" rel="noreferrer">Service</a> with <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/" rel="noreferrer">Ingress</a>.</p>

<p>Inside a cluster, you can create Service with Cluster IP (which is actually simply Service, because it always has Cluster IP) for your Redis pod and will be available on:</p>

<p><code>redis://[USER]:[PASSWORD]@[SERVICE-IP]:[PORT]</code></p>

<p>Here is a good official documentation about <a href="https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/" rel="noreferrer">connecting applications with service</a>.</p>
