New Palette Crossplane provider for easy Kubernetes clusters
If you’re like many of the customers we work with, you’re looking at technologies like Crossplane to simplify the complexity and variety of infrastructure elements you deal with.
Crossplane is an open-source “universal control plane”. It runs inside your Kubernetes cluster and enables you to declaratively control all kinds of non-Kubernetes public cloud resources (like AWS S3 storage buckets) using familiar Kubernetes commands and the Kubernetes API.
If you work in ops, Crossplane enables you to automate cloud resource management the same way you manage Kubernetes resources. Crossplane is a Kubernetes controller, so it monitors and enforces desired state across all of the cloud resources it provisions and manages, whether it’s an EC2 instance or a Mongo database.
If you’re a developer, you can use Crossplane’s declarative API to request the creation of infrastructure resources and plug it into your application without having to leave the comfort of your Kubernetes cluster. You can focus on writing cloud-agnostic code and delivering value, rather than dealing with the complexities of cloud providers. Instead, use Kubernetes as the front-end for a hybrid infrastructure ecosystem.
Crossplane is an actively developed incubating project in the Cloud Native Computing Foundation (CNCF) created by Upbound. It has gained huge popularity in a short span of time due to the ease with which it can be deployed and operated.
Just like our favorite project, Cluster API, and the popular IaC tool Terraform, you can extend Crossplane through providers. Providers are packages that bundle a set of managed resources and their controllers to allow Crossplane to provision those custom resources, so there’s a provider for Azure and another for GCP, one for Terraform and another for Argo CD and other CI/CD tools. In fact, there are lots.
Drive Palette from Crossplane with our new provider!
From Crossplane you can now drive almost all of Palette’s infrastructure management capabilities through the Palette API, meaning you can provision clusters, build and apply repeatable Cluster Profiles, deploy edge-native hosts, perform day 2 management activities, and much more, to all the infrastructure destinations that Palette supports such as AWS, GCP, Azure, Vsphere, MAAS and baremetal.
If you’re familiar with the Palette provider for Terraform, you’ll be right at home — the Palette Crossplane provider is generated from the Palette Terraform provider and therefore supports all operations that the Terraform provider supports.
Deploy a Kubernetes cluster with the Palette provider for Crossplane
In the following sections we will set up the Palette provider on an existing Kubernetes cluster running Crossplane, and use it to deploy a Kubernetes cluster on AWS using a Palette Cluster Profile.
- A Kubernetes cluster (With Crossplane installed. Refer: https://docs.crossplane.io/latest/software/install/)
- AWS account (With relevant access as we will be demonstrating the creation of resources on AWS). For more information on how to create an AWS API key, refer: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html
- A Cluster Profile to create clusters on Palette (refer: https://docs.spectrocloud.com/cluster-profiles)
Getting a Spectro Cloud Palette API key
To create a new Spectro Cloud API key, visit www.spectrocloud.com and log in to your Palette account. On the top-right, click the dropdown menu under your username and click on ‘My API Keys’ and generate a new key by clicking ‘Add a new API key’. Store this key in a safe place for later use.
Installing the Palette Crossplane provider
Providers are packaged controllers that reconcile the desired state of the cloud resources to match the current state to the desired state. Install the Crossplane provider for Palette by running the following commands:
Create the provider config:
Once the Crossplane provider for Palette is successfully installed:
- Create the secret:
From the above template, create the Palette credential secrets by running:
NOTE: Remember to update the api_key field in the credential secret with the API key created in the previous step.
- Create the providerconfig:
From the above template, create the Palette provider config by running:
Creating a cloud account
Now that we have configured the Crossplane provider, let us provision an AWS cloud account resource on the Palette platform that will help us create a Kubernetes cluster on AWS.
Create the secret containing AWS secret key:
From the above template, create the secret by running:
NOTE: Remember to update the data field in the aws secret with the secret key of the AWS access key created earlier
Create the cloudaccount resource:
From the above manifest, create the cloud account by running:
You should now see the cloud account registered and ready to use under your Spectro Cloud account.
Creating a Kubernetes cluster on AWS
The cloud account that we created in the previous step enables us to create Kubernetes clusters on AWS using the Palette platform.
Get the cloud account ID by describing the cloud account created in the previous step:
You will find the cloud account ID under ‘status.atProvider.id’
Create an AWS cluster resource:
From the above manifest, create the cluster by running:
NOTE: Use the cluster profile created as a prerequisite to provision the cluster. You can find the cluster profile ID in the URL when you select the cluster profile
The cluster profile ID is highlighted and can be found in the cluster profile URL
Once applied, check your Palette console to check the creation of your AWS cluster
The Cluster status will transition into Running and once the Cluster Health status shows up as healthy, the cluster is ready to use. You can access the Kubeconfig to the newly created cluster by clicking on the link under the ‘Kubernetes Config file’ section under ‘Overview’.
Hopefully you can already see that the Palette Crossplane provider for Kubernetes is a powerful tool that simplifies resource management. If you’re a Crossplane user, it opens up a whole new set of capabilities for you.
Now that you have got your cluster up and running using the Palette provider for Crossplane, you can use it to explore all the other things that Palette can do. Why not try creating an App Profile to model all the components of an application stack? Build a library of Cluster Profiles to make deploying future clusters repeatable? Try out Virtual Clusters for instant access to a K8s environment?
We’ll be keeping the Crossplane provider up to date in line with our Terraform provider, so the latest developments in Palette will always be at your fingertips.
For any suggestions and feedback, you can get in touch with us on the Spectro Cloud community Slack workspace. To report issues, please create an issue in the official provider repository at https://github.com/crossplane-contrib/provider-palette. To learn more about Palette and its capabilities and to try it out, please visit: https://www.spectrocloud.com/get-started.