christianhuth / crossplane-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crossplane demonstration

This is a small demonstration project for deploying a VPC and an EC2 instance on AWS using Crossplane.

Basic Setup of the Crossplane Environment

see https://docs.crossplane.io/v1.10/getting-started/install-configure/ for more details

Install Crossplane inside Kubernetes Cluster

helm repo add crossplane-stable https://charts.crossplane.io/stable
helm repo update
helm install crossplane --namespace crossplane-system --create-namespace crossplane-stable/crossplane

Install Crossplane CLI

curl -sL https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh

Setup for our Demonstration on AWS

⚠️ Setting up AWS CLI is not part of this demonstration. ⚠️

Install AWS Provider

See here for complete Docs about Provider.

Using the CLI

# default method using the provided package
kubectl crossplane install provider xpkg.upbound.io/crossplane-contrib/provider-aws:v0.34.0

Using the Template

kubectl apply -f templates/provider.yaml

Check the installed Provider

kubectl get providers
kubectl describe providers crossplane-contrib-provider-aws

As soon as the Provider is healthy you can check the provided CRDs:

kubectl api-resources | grep aws

Create Secrets for accessing Provider

AWS_PROFILE=default && echo -e "[default]\naws_access_key_id = $(aws configure get aws_access_key_id --profile $AWS_PROFILE)\naws_secret_access_key = $(aws configure get aws_secret_access_key --profile $AWS_PROFILE)" > creds.conf

kubectl create secret generic crossplane-demo-aws-credentials -n crossplane-system --from-file=creds=./creds.conf

Configure the Provider

kubectl apply -f templates/providerconfig.yaml

Create the infrastructure

kubectl apply -f templates/ec2.yaml && \
kubectl apply -f templates/vpc.yaml

Check created infrastructure

kubectl get instance,vpc

Delete infrastructure

kubectl delete -f templates/ec2.yaml && \
kubectl delete -f templates/vpc.yaml

Check deleted infrastructure

kubectl get instance,vpc

Remove Provider and ProviderConfig

kubectl delete -f templates/providerconfig.yaml && \
kubectl delete -f templates/provider.yaml

check that all api resources are deleted as well

kubectl api-resources | grep aws

About