Collection of Config Connector demos on GKE. More info about KCC here.
For more on declarative management of Kubernetes objects see docs here.
gcloudinstalled and authenticatedgclouddefaults defined (example):
gcloud config set project YOUR_PROJECT_ID
gcloud config set compute/region us-west1
gcloud config set compute/zone us-west1-cThis will create GKE cluster (kcc-demo) and configure KCC on namespace demo:
bin/setupVerify installation:
kubectl wait -n cnrm-system --for=condition=Ready pod --allIt may take a minute for the resources to be available. Eventually, if everything installed correctly, you should see at least 5 condition met statements:
pod/cnrm-controller-manager-0 condition met
pod/cnrm-deletiondefender-0 condition met
pod/cnrm-resource-stats-recorder-******-ztwpm condition met
pod/cnrm-webhook-manager-******-***** condition met
pod/cnrm-webhook-manager-******-***** condition metUse
bin/resetto reset demo state after previous runs
Show available GCP resources in UI. And by querying the cluster CRDs:
kubectl get crds --selector cnrm.cloud.google.com/managed-by-kcc=true # | grep pubsubmore info on
Show API description for the PubSubTopic:
kubectl describe crd pubsubtopics.pubsub.cnrm.cloud.google.comEnable PubSub service:
kubectl apply -f config/enable-pubsub.yamlThe YAML:
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
kind: Service
metadata:
name: pubsub.googleapis.com
spec:
projectRef:
external: projects/PROJECT_IDCreate PubSub Topic (kcc-demo-topic):
kubectl apply -f config/pubsub-topic.yamlThe YAML:
apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
metadata:
annotations:
cnrm.cloud.google.com/project-id: PROJECT_ID
name: kcc-demo-topicOnce created, you can describe the created resource:
kubectl describe pubsubtopicsYou can also navigate to the list of PubSub Topics in Console, or verify (condition met) that the resource is created via kubectl:
kubectl wait --for=condition=READY pubsubtopics kcc-demo-topicKCC is also not only for service creation, you can also manage objects in those services, see BigQuery dataset example below:
apiVersion: bigquery.cnrm.cloud.google.com/v1beta1
kind: BigQueryDataset
metadata:
name: bigquerydatasetsample
spec:
defaultTableExpirationMs: 3600000
description: "BigQuery Dataset Sample"
friendlyName: bigquerydataset-sample
location: USTo delete all resources created by this demo, including the GKE cluster service account:
bin/cleanupTo only reset demo state use bin/reset.
This is my personal project and it does not represent my employer. While I do my best to ensure that everything works, I take no responsibility for issues caused by this code.