Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

doc: replace InfisicalStaticSecret doc with complete examples per auth

Matheus Nogueirad578c986d243
diff --git a/docs/integrations/platforms/kubernetes/infisical-static-secret-crd.mdx b/docs/integrations/platforms/kubernetes/infisical-static-secret-crd.mdx
index 540d4c436e..39ee87b309 100644
--- a/docs/integrations/platforms/kubernetes/infisical-static-secret-crd.mdx
+++ b/docs/integrations/platforms/kubernetes/infisical-static-secret-crd.mdx
@@ -15,40 +15,484 @@ Before creating an `InfisicalStaticSecret`, you need:
1. An [InfisicalConnection](/integrations/platforms/kubernetes/infisical-connection-crd) resource configured with your Infisical host and TLS settings.
2. An [InfisicalAuth](/integrations/platforms/kubernetes/infisical-auth-crd) resource configured with your machine identity authentication method.
-### Example
-
-```yaml infisical-static-secret.yaml
-apiVersion: secrets.infisical.com/v1beta1
-kind: InfisicalStaticSecret
-metadata:
- name: my-static-secret
- labels:
- label-to-be-passed-to-managed-secret: sample-value
- annotations:
- example.com/annotation-to-be-passed-to-managed-secret: "sample-value"
-spec:
- infisicalAuthRef:
- name: my-infisical-auth
- namespace: default
-
- syncOptions:
- refreshInterval: 60s
- instantUpdates: false
+### Examples
- sources:
- - projectId: <your-project-id>
- environmentSlug: dev
- secretPath: /
- - projectSlug: another-project
- environmentSlug: dev
- secretPath: /
+Each example below contains every resource you need to apply: the credential `Secret`, `InfisicalConnection`, `InfisicalAuth`, and `InfisicalStaticSecret`.
+Copy the one that matches your environment, replace the placeholder values, and `kubectl apply -f` it.
- targets:
- - name: managed-secret
+For more details on each resource, see the [InfisicalConnection](/integrations/platforms/kubernetes/infisical-connection-crd) and [InfisicalAuth](/integrations/platforms/kubernetes/infisical-auth-crd) documentation.
+
+<AccordionGroup>
+ <Accordion title="Kubernetes Auth (Recommended)">
+ Best for workloads already running in Kubernetes.
+
+ This example uses **short-lived service account tokens**. If you prefer to use a Gateway as the token reviewer instead, see the [Kubernetes Auth guide](/documentation/platform/identities/kubernetes-auth) for alternative setup options.
+
+ ```yaml complete-kubernetes-auth.yaml
+ # 1. Service account used by the operator for token review
+ apiVersion: v1
+ kind: ServiceAccount
+ metadata:
+ name: infisical-service-account
namespace: default
- kind: Secret
- creationPolicy: Owner
-```
+ ---
+ # 2. Bind the service account to system:auth-delegator so it can
+ # validate tokens via the Kubernetes TokenReview API
+ apiVersion: rbac.authorization.k8s.io/v1
+ kind: ClusterRoleBinding
+ metadata:
+ name: infisical-service-account-role-binding
+ roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: system:auth-delegator
+ subjects:
+ - kind: ServiceAccount
+ name: infisical-service-account
+ namespace: default
+ ---
+ # 3. Kubernetes secret holding the machine identity ID
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: kubernetes-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ identityId: <your-machine-identity-id>
+ ---
+ # 4. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 5. Auth using a Kubernetes service account token
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: kubernetes
+ kubernetes:
+ identityIdRef:
+ name: kubernetes-credentials
+ namespace: default
+ key: identityId
+ serviceAccountRef:
+ name: infisical-service-account
+ namespace: default
+ ---
+ # 6. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+
+ <Accordion title="Universal Auth">
+ Platform-agnostic authentication using a client ID and client secret. Works in any environment.
+
+ ```yaml complete-universal-auth.yaml
+ # 1. Kubernetes secret holding the client credentials
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: universal-auth-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ clientId: <your-identity-client-id>
+ clientSecret: <your-identity-client-secret>
+ ---
+ # 2. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 3. Auth using Universal Auth credentials
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: universal
+ universal:
+ clientIdRef:
+ name: universal-auth-credentials
+ namespace: default
+ key: clientId
+ clientSecretRef:
+ name: universal-auth-credentials
+ namespace: default
+ key: clientSecret
+ ---
+ # 4. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+
+ <Accordion title="AWS IAM Auth">
+ For workloads running in AWS (EC2, Lambda, EKS). The operator uses the instance's IAM role to authenticate.
+
+ ```yaml complete-aws-iam-auth.yaml
+ # 1. Kubernetes secret holding the machine identity ID
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: aws-iam-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ identityId: <your-machine-identity-id>
+ ---
+ # 2. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 3. Auth using AWS IAM
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: aws-iam
+ awsIam:
+ identityIdRef:
+ name: aws-iam-credentials
+ namespace: default
+ key: identityId
+ ---
+ # 4. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+
+ <Accordion title="Azure Auth">
+ For workloads running in Azure. Uses the Azure managed identity attached to the compute resource.
+
+ ```yaml complete-azure-auth.yaml
+ # 1. Kubernetes secret holding the machine identity ID
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: azure-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ identityId: <your-machine-identity-id>
+ ---
+ # 2. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 3. Auth using Azure managed identity
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: azure
+ azure:
+ identityIdRef:
+ name: azure-credentials
+ namespace: default
+ key: identityId
+ ---
+ # 4. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+
+ <Accordion title="GCP ID Token Auth">
+ For workloads running in GCP. Uses the GCP metadata server to obtain an ID token.
+
+ ```yaml complete-gcp-id-token-auth.yaml
+ # 1. Kubernetes secret holding the machine identity ID
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: gcp-id-token-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ identityId: <your-machine-identity-id>
+ ---
+ # 2. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 3. Auth using a GCP ID token
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: gcp-id-token
+ gcpIdToken:
+ identityIdRef:
+ name: gcp-id-token-credentials
+ namespace: default
+ key: identityId
+ ---
+ # 4. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+
+ <Accordion title="GCP IAM Auth">
+ Uses a GCP service account key file for authentication. Works both inside and outside GCP.
+
+ ```yaml complete-gcp-iam-auth.yaml
+ # 1. Kubernetes secret holding the machine identity ID
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: gcp-iam-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ identityId: <your-machine-identity-id>
+ ---
+ # 2. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 3. Auth using GCP IAM with a service account key
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: gcp-iam
+ gcpIam:
+ identityIdRef:
+ name: gcp-iam-credentials
+ namespace: default
+ key: identityId
+ serviceAccountKeyFilePath: /path/to/service-account-key.json
+ ---
+ # 4. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+
+ <Accordion title="LDAP Auth">
+ Authenticates using LDAP credentials (username and password).
+
+ ```yaml complete-ldap-auth.yaml
+ # 1. Kubernetes secret holding LDAP credentials and the machine identity ID
+ apiVersion: v1
+ kind: Secret
+ metadata:
+ name: ldap-credentials
+ namespace: default
+ type: Opaque
+ stringData:
+ identityId: <your-machine-identity-id>
+ username: <your-ldap-username>
+ password: <your-ldap-password>
+ ---
+ # 2. Connection to the Infisical instance
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalConnection
+ metadata:
+ name: my-infisical-connection
+ spec:
+ address: https://app.infisical.com
+ ---
+ # 3. Auth using LDAP
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalAuth
+ metadata:
+ name: my-infisical-auth
+ spec:
+ infisicalConnectionRef:
+ name: my-infisical-connection
+ namespace: default
+ method: ldap
+ ldap:
+ identityIdRef:
+ name: ldap-credentials
+ namespace: default
+ key: identityId
+ usernameRef:
+ name: ldap-credentials
+ namespace: default
+ key: username
+ passwordRef:
+ name: ldap-credentials
+ namespace: default
+ key: password
+ ---
+ # 4. Sync secrets into a native Kubernetes Secret
+ apiVersion: secrets.infisical.com/v1beta1
+ kind: InfisicalStaticSecret
+ metadata:
+ name: my-static-secret
+ spec:
+ infisicalAuthRef:
+ name: my-infisical-auth
+ namespace: default
+ syncOptions:
+ refreshInterval: 60s
+ sources:
+ - projectId: <your-project-id>
+ environmentSlug: dev
+ secretPath: /
+ targets:
+ - name: managed-secret
+ namespace: default
+ kind: Secret
+ creationPolicy: Owner
+ ```
+ </Accordion>
+</AccordionGroup>
## CRD properties