To create a GKE cluster follow the next steps:
- Create a firewall rule to accept all incoming traffic and call it as allin
- Create a firewall rule to accept all outgoing traffic and call it allout
- Create the cluster in GCP
- Access the cluster
- Create a service account with the following commands:
gcloud iam service-accounts create dslatam --display-name="SA Demo Crossplane"
gcloud iam service-accounts add-iam-policy-binding [email protected] --member='serviceAccount:[email protected]' --role='roles/owner'
gcloud projects add-iam-policy-binding ${GCP_PROJECT_ID} \
--member=serviceAccount:${GCP_SVC_ACC} \
--role=roles/container.admin
- Create a key to be used in Crossplane:
gcloud iam service-accounts keys create key.json [email protected]
- To install ArgoCD run the fullowing steps:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
- Access ArgoCD by running the following command:
kubectl port-forward svc/argocd-server -n argocd 8080:443
- Install the CLI local client:
brew install argocd
- Get the current admin ArgoCD password:
argocd admin initial-password -n argocd
- Login with the admin user and previous password and update it:
argocd login --insecure localhost:8080
argocd account update-password --insecure --server localhost:8080
To install crossplane follow the next steps:
- Add the helm repository:
helm repo add \
crossplane-stable https://charts.crossplane.io/stable
helm repo update
- Install Crossplane using helm:
helm install crossplane \
crossplane-stable/crossplane \
--namespace crossplane-system \
--create-namespace
- Install the GCP Provide:
cat <<EOF | kubectl apply -f -
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-gcp-storage
spec:
package: xpkg.upbound.io/upbound/provider-gcp-storage:v0.35.0
EOF
- Create a secret that contains the credentials
kubectl create secret \
generic gcp-secret \
-n crossplane-system \
--from-file=creds=./key.json
- Instance a new GCP provider using the secret:
kubectl create ns development
cat <<EOF | kubectl apply -f -
apiVersion: gcp.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
projectID: cs-nonprod
credentials:
source: Secret
secretRef:
namespace: crossplane-system
name: gcp-secret
key: creds
EOF
Create the projects for this demo by running the following command:
kubectl apply -f projects/
Go to settings/actions in your repository and in Workflow permissions set
- Read and write permissions
- Allow GitHub Actions to create and approve pull requests
- Create a new application
- Delete an application