Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions content/docs/task-runners/04.types/03.kubernetes-task-runner.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ description: |
- clientCertData: client-certificate-data
- caCertData: certificate-authority-data
- masterUrl: server e.g. https://docker-for-desktop:6443
- username: user e.g. docker-desktop
- oauthToken: token if you are using OAuth (GKE/EKS)

inputs:
Expand All @@ -82,7 +81,6 @@ tasks:
clientCertData: client-certificate-data
caCertData: certificate-authority-data
masterUrl: server e.g. https://docker-for-desktop:6443
username: user e.g. docker-desktop
commands:
- echo "Hello from a Kubernetes task runner!"
- cp data.txt out.txt
Expand Down Expand Up @@ -266,35 +264,39 @@ id: gke_task_runner
namespace: company.team

tasks:
- id: metadata
type: io.kestra.plugin.gcp.gke.ClusterMetadata
clusterId: kestra-dev-gke
clusterZone: "europe-west1"
clusterProjectId: kestra-dev

- id: auth
type: io.kestra.plugin.gcp.auth.OauthAccessToken
projectId: "projectid" # Replace with your Project ID
serviceAccount: "{{ secret('GOOGLE_SA') }}" # update

- id: shell
- id: pod
type: io.kestra.plugin.scripts.shell.Commands
containerImage: centos
taskRunner:
containerImage: ubuntu
commands:
- echo "Hello from a Kubernetes task runner!"
taskRunner:
type: io.kestra.plugin.ee.kubernetes.runner.Kubernetes
namespace: default
config:
caCertData: "{{ secret('certificate-authority-data') }}" # update
masterUrl: https://cluster-external-endpoint # update
username: gke_projectid_region_clustername # update
caCertData: "{{ outputs.metadata.masterAuth.clusterCertificat }}"
masterUrl: "https://{{ outputs.metadata.endpoint }}"
oauthToken: "{{ outputs.auth.accessToken['tokenValue'] }}"
commands:
- echo "Hello from a Kubernetes task runner!"
```

You'll need to use the `gcloud` CLI tool to get the credentials such as `username`, `masterUrl`, and `caCertData`. You can do this by running the following command:
You'll need to use the `gcloud` CLI tool to get the credentials such as `masterUrl` and `caCertData`. You can do this by running the following command:

```bash
gcloud container clusters get-credentials clustername --region myregion --project projectid
```

You'll need to update the following arguments above with your own values:
- `clustername` is the name of your cluster.
- `myregion` is the region your cluster is in, e.g., `europe-west2`.
- `projectid` is the ID of your Google Cloud project.
- `clusterId` is the name of your cluster.
- `clusterZone` is the region your cluster is in, e.g., `europe-west2`.
- `clusterProjectId` is the ID of your Google Cloud project.

Once you've run this command, you can now access your config with `kubectl config view --minify --flatten`, so you can replace `caCertData`, `masterUrl` and `username`.

Expand Down