Skip to main content
The InfisicalStaticSecretPush CRD pushes native Kubernetes Secrets from your cluster to one or more paths in Infisical and keeps them in sync. It replaces the v1alpha1 InfisicalPushSecret CRD with a cleaner design: authentication and connection details are defined as separate reusable resources (InfisicalAuth and InfisicalConnection) instead of inline blocks.

Prerequisites

Before creating an InfisicalStaticSecretPush, you need:
  1. The Infisical Kubernetes operator v0.11.17 or later, installed in your cluster. Earlier versions don’t include InfisicalStaticSecretPush.
  2. An InfisicalConnection resource configured with your Infisical host and TLS settings.
  3. An InfisicalAuth resource configured with your machine identity authentication method. The machine identity needs permission to read, create, edit, and delete secrets at each target, and to create folders when createMissingFolders is enabled.

Examples

Each example below contains every resource you need to apply: the credential Secret, InfisicalConnection, InfisicalAuth, the Secret to push, and InfisicalStaticSecretPush. Copy the one that matches your environment, replace the placeholder values, and kubectl apply -f it. For more details on each resource, see the InfisicalConnection and InfisicalAuth documentation or access our samples.
Platform-agnostic authentication using a client ID and client secret. Works in any environment.
complete-universal-auth.yaml
For workloads running in AWS (EC2, Lambda, EKS). The operator uses the instance’s IAM role to authenticate.
complete-aws-iam-auth.yaml
For workloads running in Azure. Uses the Azure managed identity attached to the compute resource.
complete-azure-auth.yaml
For workloads running in GCP. Uses the GCP metadata server to obtain an ID token.
complete-gcp-id-token-auth.yaml
Uses a GCP service account key file for authentication. Works both inside and outside GCP.
The serviceAccountKeyFilePath must point to a file that exists inside the operator pod. You’ll need to create a Kubernetes Secret with your GCP service account key and mount it as a volume in the operator Deployment (or via Helm values). See the GCP IAM Auth guide for details.
complete-gcp-iam-auth.yaml
Authenticates using LDAP credentials (username and password).
complete-ldap-auth.yaml

CRD properties

A reference to the InfisicalAuth resource that defines how to authenticate with Infisical. The connection to the Infisical instance is resolved through the InfisicalAuth resource’s infisicalConnectionRef field.See the InfisicalAuth CRD documentation for details.
Controls the synchronization behavior.Behavior of each updatePolicy:
  • Replace: The operator keeps existing keys in sync with the sources, and takes over keys at a target that were created outside this resource
  • None: The operator only creates missing keys and never changes an existing key (including the keys this resource created), so later changes to the sources don’t reach Infisical
Behavior of each deletionPolicy:
  • Delete: The operator deletes a pushed secret from Infisical when its key is removed from the sources, when its target is removed, or when the InfisicalStaticSecretPush is deleted
  • None: The operator never deletes secrets from Infisical
The Kubernetes Secrets to push. Every key of every Secret is pushed to every target, except to a target with a template, which pushes what its template renders instead.When multiple Secrets contain the same key, the first occurrence wins: Secrets listed earlier in the array take precedence over later ones.If a source Secret doesn’t exist, the sync fails and nothing is deleted from Infisical.
An InfisicalStaticSecretPush can push any Secret the operator can read, including Secrets in other namespaces, and a template can write a source value into Infisical or into the resource’s status, for example as a key name in status.managedSecrets. Treat permission to create or edit InfisicalStaticSecretPush resources like permission to read those Secrets.
An array of Infisical paths to push the secrets to.
You have to provide either projectId or projectSlug. If none or both are set, the sync fails.
Each target is synced separately. If a target fails, the operator still pushes to the other targets, but it doesn’t delete secrets from any target until every target succeeds.

Templating

Pushing the keys of your Kubernetes Secrets as-is may not be enough. This is where templating functionality may be helpful. Using Go templates, you can format, combine, and create new key-value pairs from the source keys before pushing them to Infisical. When a target has a template, only the keys defined in template.data are pushed to that target. When no template is set, all source keys are pushed as-is. Each source key is available in the template context as .KEY, which is an object with two accessors:
  • .Value: the value of the key in the source Secret
  • .SecretPath: the target’s secretPath

Key/value template map

Bulk string template with a loop

The Sprig quote function escapes each value, so values that contain quotes, backslashes, or line breaks are pushed unchanged.

How templates are applied

  • A key that the template stops rendering is deleted from the target according to deletionPolicy, like a key removed from the sources
  • If a template fails, only its target fails, and nothing is deleted from Infisical until the template is fixed
  • When a template fails while running, the status shows where it failed but not why, because the reason can contain secret values (syntax errors are shown in full)
  • A template whose data is empty or only contains whitespace is rejected, because it would delete every secret pushed to the target
  • Only the values pushed to Infisical must be valid UTF-8, so a template can leave out a binary source value or encode it with encodeBase64
secretFrom and foldersIn look up secrets and folders fetched from Infisical, so they don’t work in an InfisicalStaticSecretPush template.
To help transform your secrets further, the operator provides a set of built-in functions that you can use in your templates.

Available helper functions

The Infisical Secrets Operator exposes a wide range of helper functions to make it easier to work with secrets in Kubernetes.
Encodes a string to a base64-encoded string (e.g. hello world becomes aGVsbG8gd29ybGQ=).Signature
Template usage
Decodes a base64-encoded string back to its original value (e.g. aGVsbG8gd29ybGQ= becomes hello world).Signature
Template usage
Extracts all private keys from a PKCS#12 archive and returns them as PKCS#8 PEM-encoded blocks (-----BEGIN PRIVATE KEY-----...). The archive must not be password-protected — use pkcs12keyPass for password-protected archives.Signature
Template usage
Same as pkcs12key, but uses the provided password to decrypt the PKCS#12 archive.Signature
Template usage
Extracts all certificates from a PKCS#12 archive and returns them as an ordered PEM chain (-----BEGIN CERTIFICATE-----...). Sort order: leaf → intermediate(s) → root. If disjunct or multiple leaf certs are provided, they are returned as-is. The archive must not be password-protected — use pkcs12certPass for password-protected archives.Signature
Template usage
Same as pkcs12cert, but uses the provided password to decrypt the PKCS#12 archive.Signature
Template usage
Takes a PEM-encoded certificate and private key and creates a base64-encoded PKCS#12 archive. The output is not password-protected — use pemToPkcs12Pass to set a password.Signature
Template usage
Same as pemToPkcs12, but encrypts the PKCS#12 archive with the provided password.Signature
Template usage
Takes a full PEM-encoded certificate chain (leaf + intermediates + root) and a private key, and creates a base64-encoded PKCS#12 archive that includes the entire chain. The output is not password-protected — use fullPemToPkcs12Pass to set a password.Signature
Template usage
Same as fullPemToPkcs12, but encrypts the PKCS#12 archive with the provided password.Signature
Template usage
Filters PEM blocks by type from a bundle containing multiple PEM blocks (e.g. extract only CERTIFICATE or PRIVATE KEY blocks). Common PEM types: CERTIFICATE, PRIVATE KEY, PUBLIC KEY, RSA PRIVATE KEY.Signature
Template usage
Filters PEM certificates by their position in a certificate chain. The chain is automatically ordered before filtering. Accepted types: leaf (end-entity certificate), intermediate (all intermediate CA certificates), root (root CA certificate). Returns an empty string if the requested type is not present in the chain.Signature
Template usage
Takes a JSON-serialized JWK and returns a PEM block of type PUBLIC KEY containing the public key. Uses x509.MarshalPKIXPublicKey internally.Signature
Template usage
Takes a JSON-serialized JWK and returns a PEM block of type PRIVATE KEY containing the private key. Uses x509.MarshalPKCS8PrivateKey internally.Signature
Template usage
Marshals a value to a YAML string. Returns an empty string on marshal error.Signature
Template usage
Parses a YAML string into a map[string]any, useful for extracting individual fields from a YAML-formatted secret (e.g. (fromYaml .DB_CONFIG.Value).host returns the host field).Signature
Template usage

Sprig functions

The Infisical Secrets Operator integrates with the Sprig library to provide additional helper functions.
We’ve removed expandEnv and env from the supported functions for security reasons.

Managing pushed secrets

The operator records the ID of every secret it pushes to Infisical in the resource’s status.managedSecrets, and it only ever deletes those secrets.
With updatePolicy: Replace, the operator takes over a key that already exists at a target: it writes the source value and records the secret in status.managedSecrets, so the key is deleted with the resource when deletionPolicy is Delete. With updatePolicy: None, the operator leaves the key unchanged and never deletes it.If the operator stops right after creating a secret, before it records the secret’s ID, the next sync takes the key over again when updatePolicy is Replace. When updatePolicy is None, the key isn’t recorded, so the operator never deletes it.
Two resources that push the same key to the same path would overwrite each other on every sync. The operator never changes or deletes a key that another InfisicalStaticSecretPush pushed, even while that resource is being deleted. The resource that didn’t push the key first reports an error that names the keys it left unchanged.The operator only checks the resources it manages: the ones in its own cluster, and if it’s namespace-scoped, only the ones in the namespaces it watches. Resources that different operators manage, for example in two clusters, can’t see each other’s keys: they overwrite each other, and deleting one with deletionPolicy: Delete deletes keys the other still pushes.Push each key from only one InfisicalStaticSecretPush.
Infisical stores secret values as text, so every value pushed must be valid UTF-8. To push binary data, store it base64-encoded in the source Secret, or encode it with encodeBase64 in a template.Infisical removes whitespace at the start and end of a value, and keeps a single trailing newline when the value ends with one.
If an approval policy covers a target, Infisical turns the operator’s changes into an approval request instead of applying them, and the sync of that target fails with an explanation. Once the request is approved, the operator takes over the secrets when updatePolicy is Replace.The operator doesn’t track approval requests yet, so every sync submits a new request. To let the operator push without approval, enable Bypass Approval for Machine Identities in the approval policy.
When deletionPolicy is Delete, Kubernetes keeps the InfisicalStaticSecretPush until the operator has deleted every secret in status.managedSecrets from Infisical. If the operator can’t delete them within 5 minutes, for example because Infisical is unreachable, it lets Kubernetes delete the resource, leaves the secrets in Infisical, and logs their IDs.
To delete the pushed secrets, the operator needs the InfisicalAuth, its InfisicalConnection, and their credential Secrets. If you delete them together with the InfisicalStaticSecretPush, for example by deleting their namespace or by running kubectl delete -f on a file that contains all of them, the operator can’t log in, and the pushed secrets stay in Infisical after the 5 minutes.Delete the InfisicalStaticSecretPush first and wait until it’s gone, or keep the InfisicalAuth and InfisicalConnection outside the namespaces of your applications.
If you change infisicalAuthRef to an InfisicalAuth that connects to another Infisical instance, the secrets pushed to the previous instance stay there. To remove them, delete the InfisicalStaticSecretPush before you change the InfisicalAuth, or delete them in Infisical.

Applying the CRD

Verify the secrets were pushed:
When the SYNCED column shows True, the secrets are in Infisical at every target.

Migrating from InfisicalPushSecret

If you push secrets with the v1alpha1 InfisicalPushSecret CRD, an InfisicalStaticSecretPush can take over the secrets that the InfisicalPushSecret pushed. The secrets aren’t deleted or recreated in Infisical during the migration. The InfisicalStaticSecretPush spec is different from the InfisicalPushSecret spec:
  • It authenticates through an InfisicalAuth resource, which connects to Infisical through an InfisicalConnection resource
  • push.secret becomes an entry in sources.secrets, and destination becomes an entry in targets, with secretsPath renamed to secretPath
  • resyncInterval becomes syncOptions.refreshInterval, and updatePolicy and deletionPolicy move under syncOptions
  • updatePolicy defaults to Replace and deletionPolicy defaults to Delete, while both default to None on an InfisicalPushSecret
  • Its templates use the v1 template syntax, which has no includeAllSecrets option (to push every source key along with the keys a template adds, use a bulk template that ranges over .)
  • It doesn’t support generators (push.generators) yet
1
Upgrade the operator to v0.11.17 or later. Earlier versions don’t include InfisicalStaticSecretPush.
2
On the InfisicalPushSecret, remove deletionPolicy or set it to None, and apply the change.
If you skip this step, deleting the InfisicalPushSecret at the end of the migration deletes the secrets from Infisical.
3
Create an InfisicalStaticSecretPush that pushes the same Secret to the same project, environment, and path as the InfisicalPushSecret. Keep updatePolicy set to Replace, so the InfisicalStaticSecretPush takes over the secrets that already exist in Infisical.
4
Check that the SYNCED column shows True for the InfisicalStaticSecretPush:
5
Delete the InfisicalPushSecret:
The secrets stay in Infisical, and the InfisicalStaticSecretPush manages them from now on.

Troubleshooting

You can check the status of your InfisicalStaticSecretPush resource by inspecting its conditions:
When reconciliation is successful, the secrets.infisical.com/LastReconcileStatus condition will have Status: "True", Reason: "OK", and Message: "Reconciliation successful". If reconciliation fails, Status will be "False", Reason will be set to Error, and Message will contain details about what went wrong. While the operator deletes the pushed secrets from Infisical, Reason is set to Deleting. The ObservedGeneration field indicates which generation of the resource spec the operator has last processed. If ObservedGeneration is less than metadata.generation, the operator hasn’t yet reconciled the latest changes to the resource.