Crossplane — Let your Kubernetes to build your cloud infrastructure

0_aClfqCg5SyDw0Dkb.png

Recent days infrastructure automation is one of the most focused across most of the organization, why? One of the main reasons is cloud adaptation. So, with that they can manage the complete infrastructure on AWS, Azure, GCE and other cloud providers.

As there are more tools to manage the infrastructure, it will be hard to manage and learn more tools for your SRE or DevOps team. What if you can manage your infrastructure via Kubernetes? Yes, you read correct. In this case, you are going to love Crossplane for sure. Let’s see what is crossplane and how to use it, also will try to compare with Terraform.

What is Crossplane?

Crossplane is a tool created by Upbound which has been released in December of 2018. It has been accepted as an incubating project by the CNCF (Cloud Native Computing Foundation) in 2020.

Crossplane is developed as a Kubernetes add-on and extends any Kubernetes cluster with the flexibility to provision and manage cloud infrastructure, services, and applications. Crossplane uses Kubernetes-styled declarative and API-driven configuration and management of infrastructure, on-premises or within the cloud.

Crossplane can be considered as a Kubernetes add-on, which means that it makes use of custom resources to provide all of its functionality. There are 4 kinds of resources,

Providers

  • They are the first kind of package in Crossplane’s terminology
  • A package is simply an OCI image, like a Docker image.
  • It installs CustomResourceDefinitions to allow for the provisioning of resources on an external service like a cloud provider
  • As of today, providers exist for AWS, GCP, Azure, ArgoCD, GitLab, Github, Kubernetes, and many more

Managed resources

  • They are installed by Providers
  • They represent infrastructure resources

Configurations

  • They are the second kind of package according to Crossplane.
  • They leverage the CompositeResourceDefinition and Composition features of Crossplane.

Composite resources

  • They are defined using Crossplane configuration.
  • They group-managed resources together to allow for the creation of more complex, business-oriented infrastructure resources.

Why Crossplane?

  • A Developer-Friendly API:
    As Crossplane builds upon Kubernetes, a developer creates a resource to request a specific service. For Kubernetes developers, this is straightforward.
  • Powerful:
    Crossplane includes support for AWS, Azure, GCP, and Alibaba, and also the community is adding support for several providers.
  • Production-Ready with the assistance of K8s:
    It uses Kubernetes controllers and additionally the idea of continuous reconciliation to run the platform. If some resource breaks (which it will), Crossplane will examine and change the resource state to desired configuration.

Benefits of Crossplane?

Here we have captured some benefits of using Crossplane in your infrastructure.

GitOps

As we have seen, GitOps may be a future, with that considering and Using Crossplane, we able to implement GitOps best practices not only on the resources running within our Kubernetes cluster but also on our infrastructure resources. Thus, all of our resources are kept in Git. An agent running within our cluster will be provided with access to our Git repository to pull any changes within Git into our Cluster.

This allows us to set up advanced deployment mechanisms. Whenever any changes occur, whether on our resources or our infrastructure, the agent will recognize those changes and pull them automatically into our cluster; should they pass our checks.

Continuous Reconciliation

Crossplane helps that we can declaratively manage our infrastructure. Meaning, we will specify within our code the properties of our infrastructure resources and Crossplane will ensure those are created as defined. The code, which details our infrastructure, is referred to as our desired state and the resources that Crossplane will create become the actual state of our infrastructure.

Once the resources have been created, Crossplane will continuously monitor the state of our infrastructure resources. Which makes sure the actual state same as desired state if not, Crossplane will then try to modify the actual state to match the desired state.

Consistency

As Crossplane allows us to define our infrastructure resources in Git. One way maintaining our infrastructure in code makes it possible to easily can manage and share across. Instead of allowing someone to make any manual changes, we can just share the files with other teams to create a new Kubernetes Cluster or similar. As a result, our infrastructure can become more consistent across teams.

Shifting Left

Shifting Left is the process of empowering developers by ensuring they are equipped to participate in infrastructure management and deployments. Instead of a dedicated DevOps team being responsible for creating and managing infrastructure in response to requests by the engineering teams, the engineering teams are provided with the necessary tools to address most common use cases themselves.

Using Crossplane, the DevOps team can define what type of infrastructure resources can be created and then provide the engineering team with examples of those resources. In contrast, if engineers have to have access to a cloud provider account to create resources, they may have less direction on which resources to create, how to create them, and how to manage the system most efficiently.

Thus, Crossplane makes it easier to empower engineering teams across the organization.

Installation of Crossplane

Let’s take a look at how Crossplane allows us to provision cloud resources.

Prerequisites

Installing Crossplane

Use Helm 3 to install the latest official stable release of Crossplane.

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

Check Crossplane Status.

                # helm list -n crossplane
# kubectl get all -n crossplane
            

Install Crossplane Command Line Interface (CLI)

Use the following command to install crossplane CLI

                # curl -sL https://raw.githubusercontent.com/crossplane/crossplane/release-1.5/install.sh | sh
            

Move executable to path /usr/local/bin

                # mv kubectl-crossplane /usr/local/bin
            

Verify the installation.

                # kubectl-crossplane --version
            

Terraform vs Crossplane

If you are more bound with terraform or spend more time on learning it, you can ask, why should I use Crossplane, as I can manage everything with Terraform. Well, that’s valid question, as both the tools are doing the same at last, provision infrastructure as a code. Still, there is too long to go with cloud, as we are still on earlier stage on cloud, the future may be very huge. So, it is important with pick the best one or two and see where we can use which one. So, Let’s understand by analyzing a few key differences between these tools.

Continue Reading https://foxutech.com/crossplane-let-your-kubernetes-to-build-your-cloud-infrastructure/

You can follow us on social media, to get some short knowledges regularly.


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies and get more readers

Join other developers and claim your FAUN account now!

Avatar

We are Foxutech

@foxutech
#devops #docker #github #rundeck #nagios #linux #containers #kubernetes #terraform #ansible #saltstack #security #automation #microservices #gitops #argocd #crossplane #prometheus
Stats
36

Influence

1k

Total Hits

11

Posts