Child pages
  • Google Kubernetes Engine Plugin
Skip to end of metadata
Go to start of metadata

The Google Kubernetes Engine (GKE) Plugin allows you to publish deployments built within Jenkins to your Kubernetes clusters running within GKE.

Plugin Information

No information for the plugin 'google-kubernetes-engine' is available. It may have been removed from distribution.

Usage

IAM Credentials

  1. Create a service account using the Google Cloud SDK.

    gcloud iam service-accounts create jenkins-gke

  2. Add the KubernetesEngineAdmin and serviceAccountUser roles to the service account:

    export PROJECT=$(gcloud info --format='value(config.project)')
    export SA_EMAIL=$(gcloud iam service-accounts list --filter="name:jenkins-gke" --format='value(email)')
    gcloud projects add-iam-policy-binding --member serviceAccount:$SA_EMAIL --role roles/container.clusterAdmin --role roles/iam.serviceAccountUser $PROJECT


  3. Download a JSON Service Account key for your newly created service account. Take note of where the file was created, you will upload it to Jenkins in a subsequent step.

    gcloud iam service-accounts keys create --iam-account $SA_EMAIL jenkins-gke.json

  4. In Jenkins, click the Credentials button on the left side of the screen. Then click System.

  5. Click Global credentials then **Add credentials ** on the left.

  6. In the Kind dropdown, select Google Service Account from private key.

  7. Enter your project name then select your JSON key that was created in the preceding steps.

  8. Click OK.

Configure Kubernetes Cluster Permissions

  1. Add the cluster-admin role to the service account group within your Kubernetes cluster:

    kubectl create clusterrolebinding serviceaccounts-cluster-admin --group=system:serviceaccounts --clusterrole=cluster-admin

Google Kubernetes Engine Publisher configuration

Each GKE Publisher configuration can point to a different GKE cluster. Follow the steps below to create one.

  1. Go to Jenkins home, and select the project to be published to GKE.
  2. Click the "Configure" button on the left nav-bar.
  3. At the bottom of the page there will be a button labeled "Add post-build action" , click the button then click Google Kubernetes Engine.
  4. Enter the Project ID housing the GKE cluster to be published to.
  5. Enter the Cluster to be published to.
  6. Enter the file path of the Kubernetes manifest within your project to be used for deployment.
  7. In the Service Account Credentials dropdown, select the credentials that you uploaded earlier.

Jenkins environment configuration

The GKE Jenkins plugin requires the kubectl binary to be installed within the Jenkins environment.

Feature requests and bug reports

Please file feature requests and bug reports under the google-kubernetes-engine-plugin component of the Jenkins CI JIRA.

Contributing

See CONTRIBUTING.md

License

See LICENSE.md