<p>In IBM Cloud Private EE, I need to go to the Web UI <code>User &gt; Configure client</code>, copy the <code>kubectl</code> config commands and then run these 5 commands on my client machine. </p>

<p>I deployed the IBM Cloud private EE on 5 VMs and have access to the master node. I am wondering if there is a way to capture these <code>kubectl config</code> commands directly from the docker containers without having a need to go to the Web UI. </p>

<p>For example: I did not want to download the <code>kubectl</code> client from google (as I just want to use same <code>kubectl</code> version which is in the ICP containers) and I used the following command to get it from the container itself.</p>

<pre><code>docker run --rm -v $(pwd):/data -e LICENSE=accept \
   ibmcom/icp-inception:2.1.0.1-ee \
   cp -r /usr/local/bin/kubectl /data
</code></pre>

<p>Then, I copied this to all VM guests so that I could access <code>kubectl</code> from any guest.</p>

<pre><code>chmod +x kubectl
for host in $(awk '/192.168.142/ {print $3}' /etc/hosts)
do
   scp kubectl $host:/bin
done
</code></pre>

<p>Where - <code>192.168.142</code> is the subnet of my VM guests.</p>

<p>But, I could not figure out how to get <code>Configure Client</code> commands without having to go to the Web UI. I need this to automate client <code>kubectl</code> command so that my environment is ready for <code>kubectl</code> commands through simple scripts.</p>

<p>You should use <strong><a href="https://www.vagrantup.com/" rel="nofollow noreferrer">Vagrant</a></strong> to automate those steps.</p>

<p>For instance, <a href="https://github.com/IBM/deploy-ibm-cloud-private/blob/ba600e9c08d5bd9fd784e1b209a07ef597052a7f/Vagrantfile#L659-L666" rel="nofollow noreferrer"><code>IBM/deploy-ibm-cloud-private/Vagrantfile</code></a> has this section:</p>

<pre><code>install_kubectl = &lt;&lt;SCRIPT
echo "Pulling #{image_repo}/kubernetes:v#{k8s_version}..."
sudo docker run -e LICENSE=#{license} --net=host -v /usr/local/bin:/data #{image_repo}/kubernetes:v#{k8s_version} cp /kubectl /data &amp;&gt; /dev/null
kubectl config set-credentials icpadmin --username=admin --password=admin &amp;&gt; /dev/null
kubectl config set-cluster icp --server=http://127.0.0.1:8888 --insecure-skip-tls-verify=true &amp;&gt; /dev/null
kubectl config set-context icp --cluster=icp --user=admin  --namespace=default &amp;&gt; /dev/null
kubectl config use-context icp &amp;&gt; /dev/null
SCRIPT
</code></pre>

<p>See more at "<a href="https://medium.com/ibm-cloud/kubernetes-ibm-cloud-private-and-vagrant-oh-my-cedc0758036f" rel="nofollow noreferrer">Kubernetes, IBM Cloud Private, and Vagrant, oh my!</a>", from <strong><a href="https://twitter.com/tpouyer" rel="nofollow noreferrer">Tim Pouyer</a></strong>.</p>
