<p>I have created one <a href="https://cloud.google.com/solutions/jenkins-on-container-engine-tutorial" rel="nofollow noreferrer">cluster</a> in google container engine &amp; in that i have deployed one pod having jenkins running in it. then configiured one job which will build,run,push &amp; deploy <a href="https://cloud.google.com/solutions/continuous-delivery-jenkins-container-engine" rel="nofollow noreferrer">sample</a> app. so all these job steps are executing except "deploy-sampleapp-step" due to below error   </p>

<p><code>[sampleapp_master-HAWDXNK5BCRQ7EWPPOHGW7RUWBBM25WIAIKOP6UBHIDYZGTMQIJA] Running shell script<br>
+ kubectl --namespace=production apply -f k8s/services/
error: group map[:0xc820374b60 apps:0xc820374bd0 authorization.k8s.io:0xc820374c40 componentconfig:0xc820374d90 extensions:0xc820374e00 policy:0xc820374e70 storage.k8s.io:0xc8202cc770 federation:0xc820374af0 autoscaling:0xc820374cb0 batch:0xc820374d20 rbac.authorization.k8s.io:0xc820374ee0 authentication.k8s.io:0xc820374fc0] is already registered</code>  </p>

<p>So I am using cluster version 1.6.4 </p>

<p>So does anyone has any idea how to escalate this problem<br>
Thanks In advance
Adding some more information that may be useful for the above question-  </p>

<blockquote>
  <p>user@yproject-173008:~$ kubectl cluster-info<br>
  Kubernetes master is running at <a href="https://IP" rel="nofollow noreferrer">https://IP</a>
  GLBCDefaultBackend is running at <a href="https://IP/api/v1/proxy/namespaces/kube-system/services/default-http-backend" rel="nofollow noreferrer">https://IP/api/v1/proxy/namespaces/kube-system/services/default-http-backend</a><br>
  Heapster is running at <a href="https://IP/api/v1/proxy/namespaces/kube-system/services/heapster" rel="nofollow noreferrer">https://IP/api/v1/proxy/namespaces/kube-system/services/heapster</a><br>
  KubeDNS is running at <a href="https://IP/api/v1/proxy/namespaces/kube-system/services/kube-dns" rel="nofollow noreferrer">https://IP/api/v1/proxy/namespaces/kube-system/services/kube-dns</a><br>
  kubernetes-dashboard is running at<br>
  <a href="https://IP/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard" rel="nofollow noreferrer">https://IP/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard</a><br>
  To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.</p>
  
  <p>user@yproject-173008:~$ kubectl version<br>
  Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.6", GitCommit:"7fa1c1756d8bc963f1a389f4a6937dc71f08ada2", GitTreeState:"clean", BuildDate:"2017-06-16T18:34:20Z", GoVersion:"go1.7.6", Compiler:"gc", Platform:"linux/amd64"}<br>
  Server Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.4", GitCommit:"d6f433224538d4f9ca2f7ae19b252e6fcb66a3ae", GitTreeState:"clean", BuildDate:"2017-05-19T18:33:17Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}   </p>
</blockquote>

<p>You are getting this error because the version of kubeAPI and version of kubectl is different. To get versions, edit Jenkins file present in the build directory to print version of kubectl client that has been used inside the jenkins slave envirnment while executing the job. In my case it was at  <code>/continuous-deployment-on-kubernetes/sample-app/Jenkinsfile</code> . Add following line-  </p>

<blockquote>
  <p>sh("kubectl version")  </p>
</blockquote>

<p>This will print the version of the kubectl used by jenkins slave. </p>

<p>I found it as <code>GitVersion:"v1.3.4"</code>. If this is the case for you then perform following steps-  </p>

<p><strong>1. Generate jenkins slave dockerfile</strong><br>
   -> create Dockerfile with following contents-</p>

<blockquote>
  <p>FROM jenkinsci/jnlp-slave<br>
      ENV CLOUDSDK_CORE_DISABLE_PROMPTS 1<br>
      ENV PATH /opt/google-cloud-sdk/bin:$PATH<br>
      USER root<br>
      RUN apt-get update -y<br>
      RUN apt-get install -y jq<br>
      RUN curl <a href="https://sdk.cloud.google.com" rel="nofollow noreferrer">https://sdk.cloud.google.com</a> | bash &amp;&amp; mv google-cloud-sdk /opt<br>
      COPY kubectl /opt/google-cloud-sdk/bin/<br>
      RUN chmod +x /opt/google-cloud-sdk/bin/kubectl  </p>
</blockquote>

<p>-> Download kubectl binary compatible with your kube-cluster. OR  Take binary present at your kube-cluster and place it in this directory.<br>
   -> build image and push it to your registry.  </p>

<blockquote>
  <p>docker build -t IMAGE_NAME .<br>
        gcloud docker -- push  IMAGE_NAME</p>
</blockquote>

<p><strong>2. Edit jenkins configuration to use this image for slave.</strong><br>
      Go to Jenkins-> Manage Jenkins->Configure System.<br>
      Scroll down to Cloud.<br>
      Select Kubernetes. Go to Images->Containers->Docker image.<br>
      Enter image name that you have pushed in step 1.<br>
      click save.<br>
<strong>3. start the job.</strong>  </p>
