<p>If I want to save credential information in K8s and then retrieve it to use out of k8s, can I do it? and how?</p>

Ya He
<p>Yes you can, <em>but you probably shouldn't</em>.</p>
<p>When you run <code>kubectl get secret</code> command, what it does behind the scenes is an api call to kubernetes api server.</p>
<p>To access the secret outside the cluster you will need to:</p>
<ul>
<li>Have the Kubernetes api exposed to the client(if not in same network)</li>
<li><a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/" rel="nofollow noreferrer">Setup authentication</a> in order to create credentials used by external clients</li>
<li>Call the <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#secret-v1-core" rel="nofollow noreferrer">secrets endpoint</a>. The endpoint is something like this <code>/api/v1/namespaces/{namespace}/secrets</code></li>
</ul>
<p>As said previous, you probably shouldn't do it, there are many tools available in the market to do secret management, they would be better suited for this kind of situation.</p>
