Skip to main content

Deploy CustomResourceDefinition,ClusterRole and Operators

Introduction

What is a custom resource(CR)

As the name suggests, custom resource (CR) are the resources that are by default not present in the Kubernetes cluster. Therefore, We call them the custom resources because we manually create them. By default, custom resources(CR) do not come with native Kubernetes installation. A new resource will be added in the Kubernetes cluster once you create custom resources.

To create a custom resource(CR), you need to have admin access to a Kubernetes cluster. Custom resources can appear and disappear in a running cluster through dynamic registration, and only the admin can update custom resources.

A resource called CRD defaults in Kubernetes, and we will create custom resources(CR) using that resource. Custom resources can be used like any other Kubernetes resource. Hence, once created, these CR can use all features of Kubernetes like security, RBAC, API service, etc.

What is a custom resource definition(CRD)

CRD is a simple and quite popular way to create a custom resource. You can create a Custom resource(CR) using CRD without any programming language. It allows us to create new types of resources without adding another API server, and You do not need to understand API Aggregation to use CRDs.

What is an Operator

Operators are software extensions to Kubernetes that make use of custom resources to manage applications and their components.

Examples:

Operator hub aggregates common operators and associated CRD/CR

CRDs @ K8saas

As today, CRDs deployment requires administator rights so we don't support CRDs deployment on your own.

If you want to use CRD, CR and operators :

  • Contact K8saas support
  • K8saas support analyze and validate the CRD
  • K8saas support deploy the concerned CRD
  • K8saas creates a ServiceAccount with proper right on CRs and update RBAC regarding new API objects
  • You deploy your operator
  • And voila !

Important notes:

  • We only support Namespaced scoped CustomResourceDefinition

Namespace Scoped Example

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: cronworkflows.argoproj.io
spec:
group: argoproj.io
names:
kind: CronWorkflow
listKind: CronWorkflowList
plural: cronworkflows
shortNames:
- cwf
- cronwf
singular: cronworkflow
scope: Namespaced # Namespaced scoped
  • Due to security constraints, we don't support Clustered scoped CustomResourcesDefinition

Cluster scoped CRD Example

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusterworkflowtemplates.argoproj.io
spec:
group: argoproj.io
names:
kind: ClusterWorkflowTemplate
listKind: ClusterWorkflowTemplateList
plural: clusterworkflowtemplates
shortNames:
- clusterwftmpl
- cwft
singular: clusterworkflowtemplate
scope: Cluster # Cluster scoped

Some Operators/CRDs we use :

  • Zalando Postgres-Operator - An operator for deploying Postgresql clusters and databases with powerful features (backups, active/active setup, teams...)
  • Prometheus Operator This operator is deployed by default on all k8saas cluster
  • KEDA k8saas KEDA is documented here
  • Cert-Manager This operator is deployed by default on all k8saas cluster and manage your SSL certificates
  • Flux Our GitOps operator used for deploying our stack !

Some Operators we're testing with you :