Skip to content

Instantly share code, notes, and snippets.

@xiangshen-dk
Created September 29, 2021 17:39
Show Gist options
  • Save xiangshen-dk/55a4004876b30e44a7050fea166d6c15 to your computer and use it in GitHub Desktop.
Save xiangshen-dk/55a4004876b30e44a7050fea166d6c15 to your computer and use it in GitHub Desktop.
GKE fluentbit with workload identity
region=us-east1
zone=${region}-b
project_id=[YOUR_PROJECT_ID]
gcloud config set compute/zone ${zone}
gcloud config set project ${project_id}
gcloud container clusters create custom-fluentbit \
--zone $zone \
--logging=SYSTEM \
--tags=gke-cluster-with-customized-fluentbit \
--workload-pool=${project_id}.svc.id.goog
gcloud iam service-accounts create fluent-bit-sa
gcloud projects add-iam-policy-binding ${project_id} \
--member "serviceAccount:fluent-bit-sa@${project_id}.iam.gserviceaccount.com" \
--role "roles/logging.logWriter"
gcloud iam service-accounts add-iam-policy-binding \
--role roles/iam.workloadIdentityUser \
--member "serviceAccount:${project_id}.svc.id.goog[logging/fluent-bit]" \
fluent-bit-sa@${project_id}.iam.gserviceaccount.com
kubectl apply -f kubernetes/test-logger.yaml
kubectl apply -f ./kubernetes/fluentbit-rbac.yaml
kubectl apply -f kubernetes/fluentbit-configmap.yaml
kubectl annotate serviceaccount \
--namespace logging fluent-bit \
iam.gke.io/gcp-service-account=fluent-bit-sa@${project_id}.iam.gserviceaccount.com
kubectl apply -f kubernetes/fluentbit-daemonset.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment