Allow ASM
Duration: 5 min | Persona: Org Admin
In this section, you will enable and grant the appropriate APIs in the Tenant project and the IAM role for the Tenant project’s service account to allow later this service account configure a Service Mesh for your GKE cluster. You will also enable the Anthos API in order to leverage the Service Mesh feature from within the Google Cloud console.
Initialize variables:
WORK_DIR=~/
source ${WORK_DIR}acm-workshop-variables.shDefine APIs
Define the Mesh API Service resource in the Tenant project:
cat <<EOF > ${WORK_DIR}$HOST_PROJECT_DIR_NAME/projects/$TENANT_PROJECT_ID/mesh-service.yaml
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
kind: Service
metadata:
annotations:
cnrm.cloud.google.com/deletion-policy: "abandon"
cnrm.cloud.google.com/disable-dependent-services: "false"
config.kubernetes.io/depends-on: resourcemanager.cnrm.cloud.google.com/namespaces/config-control/Project/${TENANT_PROJECT_ID}
name: ${TENANT_PROJECT_ID}-mesh
namespace: config-control
spec:
projectRef:
name: ${TENANT_PROJECT_ID}
resourceID: mesh.googleapis.com
EOFDefine the Cloud Trace API Service resource in the Tenant project:
cat <<EOF > ${WORK_DIR}$HOST_PROJECT_DIR_NAME/projects/$TENANT_PROJECT_ID/cloudtrace-service.yaml
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
kind: Service
metadata:
annotations:
cnrm.cloud.google.com/deletion-policy: "abandon"
cnrm.cloud.google.com/disable-dependent-services: "false"
config.kubernetes.io/depends-on: resourcemanager.cnrm.cloud.google.com/namespaces/config-control/Project/${TENANT_PROJECT_ID}
name: ${TENANT_PROJECT_ID}-cloudtrace
namespace: config-control
spec:
projectRef:
name: ${TENANT_PROJECT_ID}
resourceID: cloudtrace.googleapis.com
EOFDeploy Kubernetes manifests
cd ${WORK_DIR}$HOST_PROJECT_DIR_NAME/
git add . && git commit -m "Allow ASM for Tenant project" && git push origin mainCheck deployments
graph TD; Service-.->Project Service-.->Project
List the Kubernetes resources managed by Config Sync in Config Controller for the Host project configs repository:
Run this command and click on this link:
echo -e "https://console.cloud.google.com/kubernetes/config_management/packages?project=${HOST_PROJECT_ID}"Wait until you see the Sync status column as Synced and the Reconcile status column as Current.
Run this command:
gcloud alpha anthos config sync repo describe \
--project $HOST_PROJECT_ID \
--managed-resources all \
--sync-name root-sync \
--sync-namespace config-management-systemWait and re-run this command above until you see "status": "SYNCED". All the managed_resources listed should have STATUS: Current too.
List the GitHub runs for the Host project configs repository:
cd ${WORK_DIR}$HOST_PROJECT_DIR_NAME && gh run listList the Google Cloud resources created:
gcloud services list \
--enabled \
--project ${TENANT_PROJECT_ID} \
| grep -E 'mesh|cloudtrace'Wait and re-run this command above until you see the resources created.