Skip to main content
Version: 1.47

Custom Resource Definitions

Okteto installs several Custom Resource Definitions (CRDs) in your cluster. They mainly store the different types of information Okteto needs to work. To list them, look at the crds folder in the templates of the Okteto Helm Chart, or run:

kubectl get crd | grep okteto.com

Okteto needs these CRDs to work properly. By default, Okteto installs them, but you can install them yourself instead: the crds setting tells Okteto whether to install them.

Private Registries​

You can manage private registry configurations from the Admin Dashboard or with one of the CRDs that Okteto installs: registries.admin.okteto.com. Use the CRD when, for example, you have your own mechanism to provision credentials or secrets in your cluster.

You can configure three types of registries: static credentials, AWS IAM User, and AWS IAM Role.

Static Credentials​

To configure a private registry with static credentials, first create an Opaque Kubernetes secret with the username and password to access the registry.

Once the secret is created, you will need to create a resource with the apiVersion: admin.okteto.com/v1 and Registry kind, which is one of the CRDs installed by Okteto, referring to the secret which contains the credentials.

The name of this new resource should be the hostname of the registry (e.g. index.docker.io). For example, if you want to add a configuration for Docker's registry, you will need to create a resource like this:

note

spec.static.port is optional and only available for static registries. Set it only if the registry listens on a port other than the default HTTP(S) ports, 80 and 443.

apiVersion: admin.okteto.com/v1
kind: Registry
metadata:
name: index.docker.io # hostname of the registry to be configured
namespace: okteto
spec:
static:
port: 5000 # optional
passwordSecretRef:
key: <field in referenced secret> # key of the secret which contains the password
name: <secret-name> # name of the secret where the password is stored
userSecretRef:
key: <field in referenced secret> # key of the secret which contains the username
name: <secret-name> # name of the secret where the username is stored

AWS IAM User​

For AWS IAM User credentials (Access Key and Secret Access Key), the process is similar to configuring static credentials. First, create a secret containing the Access Key and Secret Access Key values. Then, create a CRD like this (the name of the resource has to be the hostname of the registry to be configured and it has to end with .amazonaws.com, e.g. 111122223333.dkr.ecr.eu-central-1.amazonaws.com):

apiVersion: admin.okteto.com/v1
kind: Registry
metadata:
name: 111122223333.dkr.ecr.eu-central-1.amazonaws.com # hostname of the registry to be configured
namespace: okteto
spec:
awsIamUser:
accessKeyIDSecretRef:
key: <field in referenced secret> # key of the secret which contains the access key
name: <secret-name> # name of the secret where the access key is stored
secretAccessKeySecretRef:
key: <field in referenced secret> # key of the secret which contains the access secret key
name: <secret-name> # name of the secret where the access secret is stored

You can find more information here about how to obtain the values to use.

AWS IAM Role​

In this case, the process is a bit simpler. It doesn't require a secret, as it doesn't store sensitive information. So, you will only need to create a CRD like the following one specifying the registry hostname as the resource name (it has to end with .amazonaws.com, e.g. 111122223333.dkr.ecr.eu-central-1.amazonaws.com):

apiVersion: admin.okteto.com/v1
kind: Registry
metadata:
name: 111122223333.dkr.ecr.eu-central-1.amazonaws.com # hostname of the registry to be configured
namespace: okteto
spec:
awsIamRole:
audience: okteto.example.com/us-east-2 # Audience used to exchange token to access the registry
roleARN: arn:aws:iam::112233445566:role/my-private-registry # ARN role with the permissions needed to access to the registry

You can find more information here about how to obtain the values to use.

Catalog Items​

Catalog items are usually managed from the Admin Dashboard, but you can also manage them with one of the CRDs that Okteto installs: catalogitems.git.okteto.com. Use the CRD to add catalog items with kubectl commands or to manage your catalog with GitOps.

note

Catalog items you add with CRDs are displayed in the UI, but you can't modify them from the UI. To manage a catalog item from the UI, create it there.

To configure a catalog item, create a resource like this:

  • metadata.name: the name of the CatalogItem resource
  • spec.branch: the default branch for the catalog item (optional)
  • spec.manifestPath: the path to the manifest file in the repository (optional)
  • spec.name: the display name in the Catalog UI list
  • spec.repositoryUrl: the repository URL
  • spec.variables: the variables suggested to the user at deployment time. Define each variable by name only, or by name and value (optional)
my-catalog-item.yaml
apiVersion: git.okteto.com/v1
kind: CatalogItem
metadata:
name: my-catalog-item
namespace: okteto
spec:
branch: ""
manifestPath: ""
name: my-catalog-item
repositoryUrl: https://github.com/okteto/movies-with-helm
variables:
- name: VARIABLE_WITH_VALUE
value: my-value
- name: VARIABLE_WITHOUT_VALUE

Run kubectl apply -f my-catalog-item.yaml to add the catalog item to the Okteto Catalog in your cluster.

Cloud Credentials​

Cloud Credentials are mainly managed from the Admin Dashboard, but you can also manage them with one of the CRDs that Okteto installs: dynamicconfigs.admin.okteto.com. Use the CRD to add Cloud Credentials with a kubectl command or to manage them with GitOps.

note

Credentials you add with CRDs are displayed in the UI, but you can't modify them from the UI. To manage credentials from the UI, create them there.

For example, to add a configuration for a GCP Cloud Credential, create a resource like this:

  • metadata.name: gcp-credentials-config
  • spec.audience: the intended audience for the credential, typically a URL or a string that identifies the target service or application that uses the credential.
  • spec.projectNumber: the unique identifier for your Google Cloud project, a numeric value assigned to your project when you create it in the Google Cloud Console.
  • spec.providerId: the identifier for the identity provider that authenticates the credentials.
  • spec.workloadIdentityPoolId: the identifier for the Workload Identity Pool, the pool of identities that can authenticate the credentials.
gcp-cloud-credential.yaml
apiVersion: admin.okteto.com/v1
kind: DynamicConfig
metadata:
name: gcp-credentials-config
namespace: okteto
spec:
audience: <audience>
projectNumber: <project-number>
providerId: <provider-id>
workloadIdentityPoolId: <workload-identity-pool-id>

To add a configuration for AWS Cloud Credentials, create a resource like this:

  • metadata.name: aws-credentials-config
  • spec.audience: the intended audience for the credential, typically a URL or a string that identifies the target service or application that uses the credential.
  • spec.region: the AWS region where the credentials are used.
  • spec.roleARN: the Amazon Resource Name (ARN) of the IAM role to assume. It identifies the role used to authenticate the credentials.
aws-cloud-credential.yaml
apiVersion: admin.okteto.com/v1
kind: DynamicConfig
metadata:
name: aws-credentials-config
namespace: okteto
spec:
audience: <audience>
region: <region>
roleARN: <roleARN>

To apply the changes manually, run the command kubectl apply -f aws-cloud-credential.yaml from your terminal to add the catalog item to the your Cloud Credential to the cluster.

note

Each cloud provider credential configuration in Okteto must use a specific name: gcp-credentials-config for Google Cloud Platform and aws-credentials-config for Amazon Web Services. Only one credential configuration is allowed per provider, meaning you can define one for GCP and one for AWS, but no more than one for each.

Okta User De-provisioning​

You can manage Okta user de-provisioning from the Admin Dashboard or with one of the CRDs that Okteto installs. With the CRD, Admins define de-provisioning policies declaratively, so users removed from Okta are also deactivated in Okteto automatically.

1. Create the Event Hook Token in Okta​

Follow Step 1 of Okta User De-provisioning to configure the event hook in Okta. Then continue with 2. Create the Required Secret.

2. Create the Required Secret​

Create an Opaque Kubernetes secret with the configuration for Okta user de-provisioning. The secret has two keys:

  • eventsEnabled: a boolean (true or false, base64-encoded) that enables Okta user de-provisioning
    • true → dHJ1ZQ==
    • false → ZmFsc2U=
  • eventsAuthSecret: the webhook authorization secret you set when you configured the event hook in Okta
apiVersion: v1
kind: Secret
metadata:
name: okta-deprovisioning-secret
namespace: okteto
type: Opaque
data:
eventsAuthSecret: <base64-encoded-webhook-secret>
eventsEnabled: <base64-encoded-true-or-false>

3. Create the CRD Configuration​

Define the Okta user de-provisioning resource, referencing the secret:

apiVersion: admin.okteto.com/v1
kind: DynamicConfig
metadata:
name: okta-config
namespace: okteto
secretRef: okta-deprovisioning-secret

secretRef is the name of the secret you created in 2. Create the Required Secret.

4. Apply the Configuration​

Save the secret in okta-deprovisioning-secret.yaml and the DynamicConfig in okta-deprovisioning-crd.yaml, and apply them:

kubectl apply -f okta-deprovisioning-secret.yaml
kubectl apply -f okta-deprovisioning-crd.yaml

5. Verify Okta Event Hook Integration​

Once the secret and the resource are applied, go back to the Okta admin console and verify the webhook. After verification, Okteto starts receiving User Deactivated and User Deleted events and de-provisions those users automatically.

Events sent to the webhook appear in the Reports -> System Log tab of Okta which can be useful for troubleshooting.

Known Hosts​

You can manage SSH known hosts from the Admin Dashboard or with one of the CRDs that Okteto installs. With CRDs, you define host key entries declaratively and keep them under GitOps.

note

The UI shows the entries you create with CRDs as read-only. Only entries with the label app.kubernetes.io/managed-by: okteto, which Okteto adds to the entries you create from the UI, are editable there.

1. Prepare the known_hosts content​

Collect the public host keys you want to trust, one per line, in standard OpenSSH known_hosts format, e.g.:

github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl

2. Create the Required Secret​

Create an Opaque Kubernetes secret with two base64-encoded keys:

  • content: the full content of the known_hosts file
  • enabled: a boolean flag (true or false)
    • true → dHJ1ZQ==
    • false → ZmFsc2U=
apiVersion: v1
kind: Secret
metadata:
name: ssh-known-hosts-secret
namespace: okteto
type: Opaque
data:
content: <base64-of-known_hosts>
enabled: <dHJ1ZQ==|ZmFsc2U=>

3. Create the CRD Configuration​

Reference the secret from a DynamicConfig:

apiVersion: admin.okteto.com/v1
kind: DynamicConfig
metadata:
name: ssh-known-hosts
namespace: okteto
secretRef: ssh-known-hosts-secret

4. Apply the Configuration​

Save the secret in ssh-known-hosts-secret.yaml and the DynamicConfig in ssh-known-hosts-crd.yaml, and apply them:

kubectl apply -f ssh-known-hosts-secret.yaml
kubectl apply -f ssh-known-hosts-crd.yaml

5. Verify in the Admin Dashboard​

Open the Admin Dashboard and check the SSH Known Hosts section. It lists the entries from your CRD. If enabled is true, the configuration is active.