By Eneko Perez
Kubernetes has been a wonderful tool for orchestrating microservices. It provides multiple resources for managing applications, networking, security, storage, etc. However, these applications often need external resources, most likely available on the cloud. That integration between Kubernetes and the cloud infrastructure is something that different open-source projects and companies are trying to provide. This article focuses on Crossplane, one of the most popular open-source projects to achieve this feat.
Crossplane is an open-source Kubernetes add-on designed to provision cloud infrastructure from the Kubernetes API. It is also an incubating Cloud Native Computing Foundation project. The most significant feature of Crossplane is the ability to expose a unique consistent interface to public cloud services.
The following step-by-step guide explains the capabilities of Kubernetes and Crossplane to create infrastructure or cloud resources from Kubernetes into the cloud. We will explain an example use case of creating a bucket on Alibaba Cloud as we would create any other object in Kubernetes.
helm repo add crossplane-master https://charts.crossplane.io/master/
git clone git@github.com:crossplane/addon-oam-kubernetes-local.git ../addon-oam-kubernetes-local
export ACCESS_KEY_ID=<your-access-key-id>
export ACCESS_KEY_SECRET=<your-access-key-secret>
docker build . -t ${IMG} -f ./hack/demo/Dockerfile
kind load docker-image $(IMG) || { echo >&2 "kind not installed or error loading image: $(IMG)"; exit 1; }
kubectl apply -f ./package/crds
./hack/demo/prepare-alibaba-credentials.sh
kubectl apply -f ./examples/provider.yaml
./hack/demo/helm_install_crossplane_master.sh
This is how the provider configuration looks like in the system:
apiVersion: alibaba.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
creationTimestamp: "2021-10-17T18:57:35Z"
finalizers:
- in-use.crossplane.io
generation: 2
name: default
resourceVersion: "18901"
uid: f9be0e2a-3322-4ec9-a227-56b7d564347b
spec:
credentials:
secretRef:
key: credentials
name: alibaba-account-creds
namespace: crossplane-system
source: Secret
region: cn-hongkong
status:
users: 2
apiVersion: oss.alibaba.crossplane.io/v1alpha1
kind: Bucket
metadata:
name: oss-crossplane-aliyun-test-ep
spec:
acl: private
storageClass: Standard
dataRedundancyType: LRS
writeConnectionSecretToRef:
name: oss-crossplane-aliyun-test-ep
namespace: default
This will create a secret with the credentials and connection information for this bucket as well.
kubectl apply -f bucket.yaml
A Recap of the Top Technologies Powering the 2020 Double 11 Global Shopping Festival
1,025 posts | 250 followers
FollowAlibaba Developer - May 27, 2020
Alibaba Developer - September 7, 2020
Alibaba Developer - February 1, 2021
Alibaba Cloud Native Community - February 9, 2023
Alibaba Clouder - June 30, 2020
Alibaba Cloud Native Community - March 1, 2023
1,025 posts | 250 followers
FollowAlibaba Cloud Container Service for Kubernetes is a fully managed cloud container management service that supports native Kubernetes and integrates with other Alibaba Cloud products.
Learn MoreFully managed, locally deployed Alibaba Cloud infrastructure and services with consistent user experience and management APIs with Alibaba Cloud public cloud.
Learn MoreAlibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn MoreProvides a control plane to allow users to manage Kubernetes clusters that run based on different infrastructure resources
Learn MoreMore Posts by Alibaba Cloud Community