The Infisical Secrets Operator is a Kubernetes controller that retrieves secrets from Infisical and stores them in a designated cluster.
It uses an InfisicalSecret resource to specify authentication and storage methods.
The operator continuously updates secrets and can also reload dependent deployments automatically.
Install Operator
The operator can be install via Helm or kubectl- Helm (recommended)
- Kubectl
Sync Infisical Secrets to your cluster
Once you have installed the operator to your cluster, you’ll need to create aInfisicalSecret custom resource definition (CRD).
InfisicalSecret CRD properties
hostAPI
hostAPI
hostAPI to
https://your-self-hosted-instace.com/apiWhen hostAPI is not defined the operator fetches secrets from Infisical Cloud.Advanced use case
Advanced use case
<backend-svc-name> and <namespace> with the appropriate values for your backend service and namespace.resyncInterval
resyncInterval
authentication
authentication
authentication.universalAuth
authentication.universalAuth
Create a machine identity
Create Kubernetes secret containing machine identity credentials
<your-identity-client-id> with the identity client ID and <your-identity-client-secret> with the identity client secret.Add reference for the Kubernetes secret containing the identity credentials
secretName and secretNamespace of the secret that was just created under authentication.universalAuth.credentialsRef field in the InfisicalSecret resource.secretsScope field with the project slug
projectSlug, environment slug envSlug, and secrets path
secretsPath that you want to fetch secrets from. Please see the example
below.Example
authentication.kubernetesAuth
authentication.kubernetesAuth
Obtaining the token reviewer JWT for Infisical
system:auth-delegator cluster role. As described here, this role allows delegated authentication and authorization checks, specifically for Infisical to access the TokenReview API. You can apply the following configuration file:Secret resource:Creating an identity
When creating an identity, you specify an organization level role for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles.
Now input a few details for your new identity. Here’s some guidance for each field:- Name (required): A friendly name for the identity.
- Role (required): A role from the Organization Roles tab for the identity to assume. The organization role assigned will determine what organization level resources this identity can have access to.

Adding an identity to a project


Add your identity ID & service account to your InfisicalSecret resource
authentication.kubernetesAuth.identityId field, add the identity ID of the machine identity you created.
See the example below for more details.Add your Kubernetes service account token to the InfisicalSecret resource
authentication.kubernetesAuth.serviceAccountRef.
Here you will need to enter the name and namespace of the service account.
The example below shows a complete InfisicalSecret resource with all required fields defined.secretsScope field with the project slug
projectSlug, environment slug envSlug, and secrets path
secretsPath that you want to fetch secrets from. Please see the example
below.Example
authentication.awsIamAuth
authentication.awsIamAuth
Create a machine identity
Add your identity ID to your InfisicalSecret resource
authentication.awsIamAuth.identityId field, add the identity ID of the machine identity you created. See the example below for more details.secretsScope field with the project slug
projectSlug, environment slug envSlug, and secrets path
secretsPath that you want to fetch secrets from. Please see the example
below.Example
authentication.azureAuth
authentication.azureAuth
Create a machine identity
Add your identity ID to your InfisicalSecret resource
authentication.azureAuth.identityId field, add the identity ID of the machine identity you created. See the example below for more details.secretsScope field with the project slug
projectSlug, environment slug envSlug, and secrets path
secretsPath that you want to fetch secrets from. Please see the example
below.Example
authentication.gcpIdTokenAuth
authentication.gcpIdTokenAuth
Create a machine identity
Add your identity ID to your InfisicalSecret resource
authentication.gcpIdTokenAuth.identityId field, add the identity ID of the machine identity you created. See the example below for more details.secretsScope field with the project slug
projectSlug, environment slug envSlug, and secrets path
secretsPath that you want to fetch secrets from. Please see the example
below.Example
authentication.gcpIamAuth
authentication.gcpIamAuth
Create a machine identity
Add your identity ID and service account token path to your InfisicalSecret resource
authentication.gcpIamAuth.identityId field, add the identity ID of the machine identity you created.
You’ll also need to add the service account key file path to your InfisicalSecret resource. In the authentication.gcpIamAuth.serviceAccountKeyFilePath field, add the path to your service account key file path. Please see the example below for more details.secretsScope field with the project slug
projectSlug, environment slug envSlug, and secrets path
secretsPath that you want to fetch secrets from. Please see the example
below.Example
authentication.serviceToken
authentication.serviceToken
1. Generate service token
You can generate a service token for an Infisical project by heading over to the Infisical dashboard then to Project Settings.2. Create Kubernetes secret containing service token
Once you have generated the service token, you will need to create a Kubernetes secret containing the service token you generated. To quickly create a Kubernetes secret containing the generated service token, you can run the command below. Make sure you replace<your-service-token-here> with your service token.3. Add reference for the Kubernetes secret containing service token
Once the secret is created, add the name and namespace of the secret that was just created underauthentication.serviceToken.serviceTokenSecretReference field in the InfisicalSecret resource.secretsScope field with the, environment slug
envSlug, and secrets path secretsPath that you want to fetch secrets
from. Please see the example below.Example
managedSecretReference
managedSecretReference
managedSecretReference field is used to define the target location for storing secrets retrieved from an Infisical project.
This field requires specifying both the name and namespace of the Kubernetes secret that will hold these secrets.
The Infisical operator will automatically create the Kubernetes secret with the specified name/namespace and keep it continuously updated.Note: The managed secret be should be created in the same namespace as the deployment that will use it.managedSecretReference.secretName
managedSecretReference.secretName
managedSecretReference.secretNamespace
managedSecretReference.secretNamespace
managedSecretReference.secretType
managedSecretReference.secretType
managedSecretReference.creationPolicy
managedSecretReference.creationPolicy
Available options
Orphan(default)Owner
Propagating labels & annotations
The operator will transfer all labels & annotations present on theInfisicalSecret CRD to the managed Kubernetes secret to be created.
Thus, if a specific label is required on the resulting secret, it can be applied as demonstrated in the following example:
Example propagation
Example propagation
Apply the Infisical CRD to your cluster
Once you have configured the Infisical CRD with the required fields, you can apply it to your cluster. After applying, you should notice that the managed secret has been created in the desired namespace your specified.Verify managed secret creation
To verify that the operator has successfully created the managed secret, you can check the secrets in the namespace that was specified.Using managed secret in your deployment
Incorporating the managed secret created by the operator into your deployment can be achieved through several methods. Here, we will highlight three of the most common ways to utilize it. Learn more about Kubernetes secrets hereenvFrom
envFrom
env
env
volumes
volumes
Auto redeployment
Deployments using managed secrets don’t reload automatically on updates, so they may use outdated secrets unless manually redeployed. To address this, we added functionality to automatically redeploy your deployment when its managed secret updates.Enabling auto redeploy
To enable auto redeployment you simply have to add the following annotation to the deployment that consumes a managed secretDeployment example with auto redeploy enabled
Deployment example with auto redeploy enabled
How it works
When a secret change occurs, the operator will check to see which deployments are using the operator-managed Kubernetes secret that received the update. Then, for each deployment that has this annotation present, a rolling update will be triggered.Global configuration
To configure global settings that will apply to all instances ofInfisicalSecret, you can define these configurations in a Kubernetes ConfigMap.
For example, you can configure all InfisicalSecret instances to fetch secrets from a single backend API without specifying the hostAPI parameter for each instance.
Available global properties
Applying global configurations
All global configurations must reside in a Kubernetes ConfigMap namedinfisical-config in the namespace infisical-operator-system.
To apply global configuration to the operator, copy the following yaml into infisical-config.yaml file.
Troubleshoot operator
If the operator is unable to fetch secrets from the API, it will not affect the managed Kubernetes secret. It will continue attempting to reconnect to the API indefinitely. The InfisicalSecret resource uses thestatus.conditions field to report its current state and any errors encountered.
Uninstall Operator
The managed secret created by the operator will not be deleted when the operator is uninstalled.- Helm
- Kubectl