Answers: <p>Taking the url from cluster-info and creating a config file with jenkins and using at as secret did the trick to pass the connection.
  I am still curious how to authenticate with a bearer token though. I have tried to use existing managed Jenkins secret, but it failed with it.</p>
  <p>Update: The authentication happens, but after creating pods the job never runs.
  Update: It looks like using jenkinsci docker image as a hardcoded podtemplate works, I try to work with Groovy provisioned yaml template that calls GCR and there I got the firstly mentioned error.</p>
  
Answers: CC BY-SA 4.0
Answers: 2020-07-10T14:28:32.560Z
Answers: 2020-07-10T14:53:11.050Z
Answers: 2020-07-10T14:53:11.050Z
Answers: anVzdGFub3RoZXJodW1hbg
Body: <p>For a test purpose I need to use my locally provisioned Jenkins with Vagrant in order to connect to GKE and use pods to build. Is that possible, because from what I read K8s will need access to Jenkins as well. How can I achieve that?</p>
  <p>Looks to be possible, but I am stuck on access rights for now:</p>
  <pre><code>o.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://xxxxxx/api/v1/namespaces/cicd/pods?labelSelector=jenkins%3Dslave. Message: pods is forbidden: User &quot;system:anonymous&quot; cannot list resource &quot;pods&quot; in API group &quot;&quot; in the namespace &quot;cicd&quot;. Received status: Status(apiVersion=v1, code=403, details=StatusDetails(causes=[], group=null, kind=pods, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=pods is forbidden: User &quot;system:anonymous&quot; cannot list resource &quot;pods&quot; in API group &quot;&quot; in the namespace &quot;cicd&quot;, metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Forbidden, status=Failure, additionalProperties={}).
  </code></pre>
  
Tags: <jenkins><kubernetes>
Title: Control GKE CICD from a Jenkins in a lab with private network?
UserDisplayName: anVzdGFub3RoZXJodW1hbg
ThreadText: # Control GKE CICD from a Jenkins in a lab with private network?
  
  (Asked by: username_0 on 2020-07-10)
  
  For a test purpose I need to use my locally provisioned Jenkins with Vagrant in order to connect to GKE and use pods to build. Is that possible, because from what I read K8s will need access to Jenkins as well. How can I achieve that?
  
  Looks to be possible, but I am stuck on access rights for now:
  
  ```
  o.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://xxxxxx/api/v1/namespaces/cicd/pods?labelSelector=jenkins%3Dslave. Message: pods is forbidden: User "system:anonymous" cannot list resource "pods" in API group "" in the namespace "cicd". Received status: Status(apiVersion=v1, code=403, details=StatusDetails(causes=[], group=null, kind=pods, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=pods is forbidden: User "system:anonymous" cannot list resource "pods" in API group "" in the namespace "cicd", metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Forbidden, status=Failure, additionalProperties={}).
  
  ```
  
  **Tags:** jenkins, kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-07-10. Score: 2
  
  Taking the url from cluster-info and creating a config file with jenkins and using at as secret did the trick to pass the connection.
  I am still curious how to authenticate with a bearer token though. I have tried to use existing managed Jenkins secret, but it failed with it.
  
  Update: The authentication happens, but after creating pods the job never runs.
  Update: It looks like using jenkinsci docker image as a hardcoded podtemplate works, I try to work with Groovy provisioned yaml template that calls GCR and there I got the firstly mentioned error.
  
  
  ---
  
  