<p>Currently I try to use <code>KubeVirt</code> with <code>GKE</code> cluster.</p>

<p>What I have done (follow the official document):</p>

<ol>
<li>Create a <code>GKE</code> cluster with 3 nodes via GCP console</li>
<li>Install <code>kubectl</code> locally and connect to this cluster</li>
<li>Install <code>kubevirt</code> via <code>kubectl</code> </li>
<li>Install <code>virtctl</code> locally</li>
<li>set <code>debug.useEmulation</code> to <code>true</code></li>
<li>create the <code>testvm</code> (follow the demo)
All the steps above work fine.</li>
</ol>

<p>But now I have troubles to start the vm</p>

<ol>
<li>If I try to start it via <code>"virtctl start testvm"</code>, I get the following error message:</li>
</ol>

<p><strong>"Error starting VirtualMachine the server has asked for the client to provide credentials"</strong></p>

<ol start="2">
<li>If I try to modify the VM template to set it running by default, it doesn't work either.In the <code>virt-launcher</code> pod, the compute container starts successfully but the <code>volumecontainerdisk</code> fails, with the following log:</li>
</ol>

<pre class="lang-py prettyprint-override"><code>standard_init_linux.go:211: exec user process caused "permission denied"
</code></pre>

<p>Any help is appreciated, thanks.</p>

<p>It seems there are issues with the default GKE auth method when connecting from local to a cluster when using <code>gcloud container clusters get-credentials...</code>.</p>
<p>What worked for me is creating a new SA and creating a kubeconfig for it:</p>
<pre><code>{
kubectl create sa deployer
kubectl create clusterrolebinding deployer --clusterrole cluster-admin --serviceaccount default:deployer

KUBE_DEPLOY_SECRET_NAME=`kubectl get sa deployer -o jsonpath='{.secrets[0].name}'`
KUBE_API_EP=`kubectl get ep -o jsonpath='{.items[0].subsets[0].addresses[0].ip}'`
KUBE_API_TOKEN=`kubectl get secret $KUBE_DEPLOY_SECRET_NAME -o jsonpath='{.data.token}'|base64 --decode`
KUBE_API_CA=`kubectl get secret $KUBE_DEPLOY_SECRET_NAME -o jsonpath='{.data.ca\.crt}'|base64 --decode`
echo $KUBE_API_CA &gt; tmp.deploy.ca.crt

export KUBECONFIG=./my-new-kubeconfig
kubectl config set-cluster k8s --server=https://$KUBE_API_EP --certificate-authority=tmp.deploy.ca.crt --embed-certs=true
kubectl config set-credentials k8s-deployer --token=$KUBE_API_TOKEN
kubectl config set-context k8s --cluster k8s --user k8s-deployer
kubectl config use-context k8s

rm tmp.deploy.ca.crt
unset KUBECONFIG
}

kubectl virt start testvm --kubeconfig ./my-new-kubeconfig
</code></pre>
<p>More explanation: <a href="https://faun.pub/manually-connect-to-your-kubernetes-cluster-from-the-outside-d852346a7f0a" rel="nofollow noreferrer">https://faun.pub/manually-connect-to-your-kubernetes-cluster-from-the-outside-d852346a7f0a</a></p>
