Collection of Config Connector demos on GKE. More info about KCC here.
For more on declarative management of Kubernetes objects see docs here.
gcloud
installed and authenticatedgcloud
defaults defined (example):
gcloud config set project YOUR_PROJECT_ID
gcloud config set compute/region us-west1
gcloud config set compute/zone us-west1-c
This will create GKE cluster (kcc-demo
) and configure KCC on namespace demo
:
bin/setup
Verify installation:
kubectl wait -n cnrm-system --for=condition=Ready pod --all
It 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 met
Use
bin/reset
to 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 pubsub
more info on
Show API description for the PubSubTopic:
kubectl describe crd pubsubtopics.pubsub.cnrm.cloud.google.com
Enable PubSub service:
kubectl apply -f config/enable-pubsub.yaml
The YAML:
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
kind: Service
metadata:
name: pubsub.googleapis.com
spec:
projectRef:
external: projects/PROJECT_ID
Create PubSub Topic (kcc-demo-topic
):
kubectl apply -f config/pubsub-topic.yaml
The YAML:
apiVersion: pubsub.cnrm.cloud.google.com/v1beta1
kind: PubSubTopic
metadata:
annotations:
cnrm.cloud.google.com/project-id: PROJECT_ID
name: kcc-demo-topic
Once created, you can describe the created resource:
kubectl describe pubsubtopics
You 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-topic
KCC 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: US
To delete all resources created by this demo, including the GKE cluster service account:
bin/cleanup
To 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.