-
Kubectl
-
Gcloud
-
To install gcloud, please see here
-
initialize the gcloud CLI
-
Start by creating a new Google Cloud (GCP) project. When trying out KRO, we suggested that you use a separate project to avoid disrupting any production clusters or services. You may choose to follow your own best practices in setting up the project.
Steps to setup a new GCP project:
# in *nix shell USER should be set. if not set USERNAME explicitly
export USERNAME=${USER?}
export PROJECT_ID=kro-${USERNAME?}
export REGION=us-central1 # << CHANGE region here
# Please set the appropriate folder, billing
export GCP_FOLDER=0000000000
export GCP_BILLING=000000-000000-000000
export ADMINUSER=someone@company.com
# Separate Gcloud configuration
gcloud config configurations create kro
gcloud config configurations activate kro
gcloud config set account ${ADMINUSER?}
# Create the project
gcloud projects create ${PROJECT_ID?} --folder=${GCP_FOLDER?}
gcloud auth application-default set-quota-project ${PROJECT_ID?}
# attach billing (THIS IS IMPORTANT)
gcloud beta billing projects link ${PROJECT_ID?} --billing-account ${GCP_BILLING?}
# Set the project ID in the current configuration
gcloud config set project ${PROJECT_ID?}
Enable the following required APIs:
gcloud services enable \
container.googleapis.com \
cloudresourcemanager.googleapis.com \
serviceusage.googleapis.com
- Create GKE Cluster:
- Navigate to the GCP console Create Standard GKE cluster page.
- Set the name of the cluster (to say "kro")
- Enable Workload Identity under Cluster-Security settings.
- Click create cluster. This step takes 5-10 mins.
- Install KCC using these instructions:
gcloud storage cp gs://configconnector-operator/latest/release-bundle.tar.gz release-bundle.tar.gz tar zxvf release-bundle.tar.gz kubectl apply -f operator-system/configconnector-operator.yaml- Create SA and bind with KSA with KCC
gcloud iam service-accounts create kcc-operator gcloud projects add-iam-policy-binding ${PROJECT_ID}\ --member="serviceAccount:kcc-operator@${PROJECT_ID}.iam.gserviceaccount.com" \ --role="roles/owner" gcloud iam service-accounts add-iam-policy-binding kcc-operator@${PROJECT_ID}.iam.gserviceaccount.com \ --member="serviceAccount:${PROJECT_ID}.svc.id.goog[cnrm-system/cnrm-controller-manager]" \ --role="roles/iam.workloadIdentityUser" gcloud projects add-iam-policy-binding ${PROJECT_ID}\ --member="serviceAccount:kcc-operator@${PROJECT_ID}.iam.gserviceaccount.com" \ --role="roles/storage.admin"kubectl apply -f - <<EOF apiVersion: core.cnrm.cloud.google.com/v1beta1 kind: ConfigConnector metadata: name: configconnector.core.cnrm.cloud.google.com spec: mode: cluster googleServiceAccount: "kcc-operator@${PROJECT_ID?}.iam.gserviceaccount.com" stateIntoSpec: Absent EOF- Create a namespace for KCC objects
kubectl create namespace config-connector kubectl annotate namespace config-connector cnrm.cloud.google.com/project-id=${PROJECT_ID?}- Verify KCC Installation
kubectl wait -n cnrm-system --for=condition=Ready pod --all - Setup Kubectl to target the cluster
gcloud container clusters get-credentials kro --region $REGION --project $PROJECT_ID - Install KRO following instructions here
If you are operating in a dev environment and want to clean it up, follow these steps:
# in *nix shell USER should be set. if not set USERNAME explicitly
export USERNAME=${USER?}
export PROJECT_ID=compositions-${USERNAME?}
export REGION=us-west2
export CONFIG_CONTROLLER_NAME=compositions
# Delete the GCP project if you created one for trying out KRO
gcloud projects delete ${PROJECT_ID?}
# Delete gcloud configuration
gcloud config confi
2E72
gurations activate <anything other than 'compositions'>
gcloud config configurations delete compositions
# Delete kubectl context
kubectl config delete-context \
gke_${PROJECT_ID?}_${REGION?}_krmapihost-${CONFIG_CONTROLLER_NAME?}
# Dont forget to switch to another context
kubectl config get-contexts
kubectl config use-context <context name>