Installing Crossplane with Yandex Cloud support
Crossplane
You can install Crossplane in any of the following ways:
- Using Yandex Cloud Marketplace in the management console.
- Using a Helm chart from the Cloud Marketplace repository.
- Using a Helm chart from the Crossplane repository.
Getting started
-
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the
--folder-name
or--folder-id
parameter. -
Create a service account with the
admin
role for the folder where you want to manage resources using Crossplane. -
Create an authorized key for the service account and save it to a file:
yc iam key create \ --service-account-name <service_account_name> \ --output key.json
-
Make sure that the security groups for the Managed Service for Kubernetes cluster and its node groups are configured correctly. If any rule is missing, add it.
Warning
The configuration of security groups determines the performance and availability of the cluster and the services and applications running in it.
Installation in the management console using Cloud Marketplace
- Go to the folder page
and select Managed Service for Kubernetes. - Click the name of the Managed Service for Kubernetes cluster you need and select the
Marketplace tab. - Under Application available for installation, select Crossplane with Yandex Cloud support and click Go to install.
- Configure the application:
- Namespace: Select a namespace for Crossplane or create a new one.
- Application name: Specify the app name.
- Service account key: Paste the contents of the file with the service account authorized key you obtained earlier or create a new one.
- Click Install.
- Wait for the application to change its status to
Deployed
.
When installing Crossplane from Cloud Marketplace, a provider
You can change the provider settings, e.g., specify the default cloud and folder to create your resources in.
For more information about Yandex Cloud resources you can create with Crossplane, see Getting information about resources.
Installation using a Helm chart from the Cloud Marketplace repository
-
Install Helm
v3.8.0 or higher. -
Install kubectl
and configure it to work with the created cluster. -
To install a Helm chart
with Crossplane, run the following command:helm pull oci://cr.yandex/yc-marketplace/yandex-cloud/crossplane/crossplane \ --version 1.15.1 \ --untar && \ helm install \ --namespace <namespace> \ --create-namespace \ --set-file providerJetYc.creds=key.json \ crossplane ./crossplane/
Note
If you are using a Helm version below 3.8.0, append the
export HELM_EXPERIMENTAL_OCI=1 && \
string to the command to enable Open Container Initiative (OCI) support in the Helm client. -
Make sure the state of all Crossplane pods changed to
Running
:kubectl get pods -A | grep -E "crossplane|provider-jet-yc"
When installing Crossplane from Cloud Marketplace, a provider
You can change the provider settings, e.g., specify the default cloud and folder to create your resources in.
For more information about Yandex Cloud resources you can create with Crossplane, see Getting information about resources.
Installation using a Helm chart from the Crossplane repository
-
Install Helm
v3.8.0 or higher. -
Install kubectl
and configure it to work with the created cluster. -
Create a namespace for Crossplane:
kubectl create namespace <namespace>
-
Add the Helm GitHub repository:
helm repo add crossplane-stable https://charts.crossplane.io/stable && \ helm repo update
-
Install Crossplane:
helm install crossplane --namespace <namespace> crossplane-stable/crossplane
-
Make sure that Crossplane is installed and running:
helm list --namespace <namespace> && \ kubectl get all --namespace <namespace>
-
Install the Crossplane CLI:
curl --silent --location https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh | sh && \ sudo mv kubectl-crossplane $(dirname $(which kubectl))
-
Install the provider:
crossplane xpkg install provider xpkg.upbound.io/yandexcloud/crossplane-provider-yc:v0.5.1
The current provider version is available in the GitHub repository
. -
Create a secret named
yc-creds
:kubectl create secret generic yc-creds \ --namespace "<namespace>" \ --from-file=credentials=<path_to_key.json>
-
Make sure the Yandex Cloud provider
is installed:kubectl get provider
-
Create the
providerconfig.yaml
Crossplane manifest with the Yandex Cloud provider settings:apiVersion: yandex-cloud.jet.crossplane.io/v1beta1 kind: ProviderConfig metadata: name: default spec: credentials: cloudId: <cloud_ID> folderId: <folder_ID> source: Secret secretRef: name: yc-creds namespace: <namespace> key: credentials
-
Apply the provider settings:
kubectl apply -f providerconfig.yaml
Configuring the provider
-
To change the Yandex Cloud provider settings for Crossplane, e.g., specify the default cloud and folder to create resources in, run this command:
kubectl edit ProviderConfig/default
-
Edit the parameters you want to update and save the changes.
Getting information about resources
-
View the list of Yandex Cloud resources you can create using Crossplane:
kubectl get crd | grep yandex-cloud.jet.crossplane.io
-
View the parameters you can set with Crossplane for a specific resource:
kubectl describe crd <resource_name>
For example, request the parameters for creating a Yandex Compute Cloud VM:
kubectl describe crd instances.compute.yandex-cloud.jet.crossplane.io
For examples of how to configure Yandex Cloud resources, see the provider's GitHub repository
.