<p>During a search on updating PODs in a Kubernetes cluster I found a Jenkis plugin called kubernetes-cd, however, I am in doubt about how to establish a secure connection with the plugin and Kubernetes and would like to know how to set up a user and password or register an ssh key in the cluster that allows this external connection?</p>

<p>I found in the Kubernetes documentation on Secrets(<a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">link</a>), but I'm not sure if it serves only for internal cluster authentication or if it serves to set up accounts for plugin connections or other external media.</p>

user2831852
<p><a href="https://jenkins.io/doc/pipeline/steps/kubernetes-cd/" rel="nofollow noreferrer">Kubernetes-cd</a> 3 options are supported:</p>

<ol>
<li><strong>Authenticate with Kube config file</strong> - Get the kubeconfig file from
the workspace path.</li>
<li><strong>Fetch cluster details through SSH connection to the master node</strong> -
Get the <code>~/.kube/config</code> file through an SSH connection to the master
node.</li>
<li><strong>Fill credentials details directly</strong> - Fill the contents in kubeconfig
file directly.</li>
</ol>

<p>You need configure ~/.kube/config on you runner.</p>

<p>Example:</p>

<pre><code>echo "$KUBE_CA_CERT" &gt; /ca.pem
kubectl config set-cluster cluster --server=${KUBE_MASTER_URL} --certificate-authority=/ca.pem
kubectl config set-credentials user --token=${KUBE_TOKEN}
kubectl config set-context context --cluster=cluster --user=user
kubectl config use-context context
</code></pre>

<ul>
<li><code>$KUBE_CA_CERT</code> - usually lies on the master
<code>/etc/kubernetes/ssl/ca.pem</code> </li>
<li><code>$KUBE_MASTER_URL</code> - you kubernetes
master url with port </li>
<li><code>$KUBE_TOKEN</code> - you token, how get it -
<a href="https://stackoverflow.com/questions/48228534/kubernetes-dashboard-access-using-config-file-not-enough-data-to-create-auth-inf/48241411#48241411">Kubernetes Dashboard access using config file Not enough data to create auth info structure.</a></li>
</ul>
