mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 10:28:22 +00:00
Update infisical-secret-crd.mdx
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
---
|
---
|
||||||
sidebarTitle: "InfisicalSecret CRD"
|
sidebarTitle: "InfisicalSecret CRD"
|
||||||
title: "InfisicalSecret CRD"
|
title: "Using the InfisicalSecret CRD"
|
||||||
description: "Learn how to use the InfisicalSecret CRD to fetch secrets from Infisical and store them as native Kubernetes secret resource"
|
description: "Learn how to use the InfisicalSecret CRD to fetch secrets from Infisical and store them as native Kubernetes secret resource"
|
||||||
---
|
---
|
||||||
|
|
||||||
Once you have installed the operator to your cluster, you'll need to create a `InfisicalSecret` custom resource definition (CRD).
|
Once you have installed the operator to your cluster, you'll need to create a `InfisicalSecret` custom resource definition (CRD).
|
||||||
|
In this CRD, you'll define the authentication method to use, the secrets to fetch, and the target location to store the secrets within your cluster.
|
||||||
|
|
||||||
```yaml example-infisical-secret-crd.yaml
|
```yaml example-infisical-secret-crd.yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
@@ -19,104 +20,28 @@ spec:
|
|||||||
hostAPI: https://app.infisical.com/api
|
hostAPI: https://app.infisical.com/api
|
||||||
resyncInterval: 10
|
resyncInterval: 10
|
||||||
authentication:
|
authentication:
|
||||||
# Make sure to only have 1 authentication method defined, serviceToken/universalAuth.
|
|
||||||
# If you have multiple authentication methods defined, it may cause issues.
|
|
||||||
|
|
||||||
# (Deprecated) Service Token Auth
|
|
||||||
serviceToken:
|
|
||||||
serviceTokenSecretReference:
|
|
||||||
secretName: service-token
|
|
||||||
secretNamespace: default
|
|
||||||
secretsScope:
|
|
||||||
envSlug: <env-slug>
|
|
||||||
secretsPath: <secrets-path>
|
|
||||||
recursive: true
|
|
||||||
|
|
||||||
# Universal Auth
|
|
||||||
universalAuth:
|
|
||||||
secretsScope:
|
|
||||||
projectSlug: new-ob-em
|
|
||||||
envSlug: dev # "dev", "staging", "prod", etc..
|
|
||||||
secretsPath: "/" # Root is "/"
|
|
||||||
recursive: true # Whether or not to use recursive mode (Fetches all secrets in an environment from a given secret path, and all folders inside the path) / defaults to false
|
|
||||||
credentialsRef:
|
|
||||||
secretName: universal-auth-credentials
|
|
||||||
secretNamespace: default
|
|
||||||
|
|
||||||
# Native Kubernetes Auth
|
|
||||||
kubernetesAuth:
|
kubernetesAuth:
|
||||||
identityId: <machine-identity-id>
|
identityId: <machine-identity-id>
|
||||||
serviceAccountRef:
|
serviceAccountRef:
|
||||||
name: <service-account-name>
|
name: <service-account-name>
|
||||||
namespace: <service-account-namespace>
|
namespace: <service-account-namespace>
|
||||||
|
|
||||||
# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
|
|
||||||
secretsScope:
|
|
||||||
projectSlug: your-project-slug
|
|
||||||
envSlug: prod
|
|
||||||
secretsPath: "/path"
|
|
||||||
recursive: true
|
|
||||||
|
|
||||||
# AWS IAM Auth
|
|
||||||
awsIamAuth:
|
|
||||||
identityId: <your-machine-identity-id>
|
|
||||||
|
|
||||||
# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
|
|
||||||
secretsScope:
|
|
||||||
projectSlug: your-project-slug
|
|
||||||
envSlug: prod
|
|
||||||
secretsPath: "/path"
|
|
||||||
recursive: true
|
|
||||||
|
|
||||||
# Azure Auth
|
|
||||||
azureAuth:
|
|
||||||
identityId: <your-machine-identity-id>
|
|
||||||
resource: https://management.azure.com/&client_id=CLIENT_ID # (Optional) This is the Azure resource that you want to access. For example, "https://management.azure.com/". If no value is provided, it will default to "https://management.azure.com/"
|
|
||||||
|
|
||||||
# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
|
|
||||||
secretsScope:
|
|
||||||
projectSlug: your-project-slug
|
|
||||||
envSlug: prod
|
|
||||||
secretsPath: "/path"
|
|
||||||
recursive: true
|
|
||||||
|
|
||||||
# GCP ID Token Auth
|
|
||||||
gcpIdTokenAuth:
|
|
||||||
identityId: <your-machine-identity-id>
|
|
||||||
|
|
||||||
# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
|
|
||||||
secretsScope:
|
|
||||||
projectSlug: your-project-slug
|
|
||||||
envSlug: prod
|
|
||||||
secretsPath: "/path"
|
|
||||||
recursive: true
|
|
||||||
|
|
||||||
# GCP IAM Auth
|
|
||||||
gcpIamAuth:
|
|
||||||
identityId: <your-machine-identity-id>
|
|
||||||
|
|
||||||
# secretsScope is identical to the secrets scope in the universalAuth field in this sample.
|
|
||||||
secretsScope:
|
|
||||||
projectSlug: your-project-slug
|
|
||||||
envSlug: prod
|
|
||||||
secretsPath: "/path"
|
|
||||||
recursive: true
|
|
||||||
|
|
||||||
managedSecretReferences:
|
managedSecretReferences:
|
||||||
- secretName: managed-secret
|
- secretName: managed-secret
|
||||||
secretNamespace: default
|
secretNamespace: default
|
||||||
creationPolicy: "Orphan" ## Owner | Orphan
|
creationPolicy: "Orphan"
|
||||||
- secretName: managed-secret-2
|
template:
|
||||||
secretNamespace: default
|
includeAllSecrets: true
|
||||||
creationPolicy: "Owner" ## Owner | Orphan
|
data:
|
||||||
# secretType: kubernetes.io/dockerconfigjson
|
NEW_KEY_NAME: "{{ .KEY.SecretPath }} {{ .KEY.Value }}"
|
||||||
# template:
|
KEY_WITH_BINARY_VALUE: "{{ .KEY.SecretPath }} {{ .KEY.Value }}"
|
||||||
# includeAllSecrets: true
|
|
||||||
# data:
|
|
||||||
# CUSTOM_KEY: "{{ .KEY.SecretPath }} {{ .KEY.Value }}"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### InfisicalSecret CRD properties
|
## CRD properties
|
||||||
|
|
||||||
|
### Generic
|
||||||
|
|
||||||
|
The following properties help define what instance of Infisical the operator will interact with, the interval it will sync secrets and any CA certificates that may be required to connect.
|
||||||
|
|
||||||
<Accordion title="hostAPI">
|
<Accordion title="hostAPI">
|
||||||
If you are fetching secrets from a self-hosted instance of Infisical set the value of `hostAPI` to
|
If you are fetching secrets from a self-hosted instance of Infisical set the value of `hostAPI` to
|
||||||
@@ -146,33 +71,36 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
<Accordion title="tls">
|
<Accordion title="tls">
|
||||||
This block defines the TLS settings to use for connecting to the Infisical
|
This block defines the TLS settings to use for connecting to the Infisical
|
||||||
instance.
|
instance.
|
||||||
|
|
||||||
<Accordion title="tls.caRef">
|
|
||||||
This block defines the reference to the CA certificate to use for connecting
|
|
||||||
to the Infisical instance with SSL/TLS.
|
|
||||||
</Accordion>
|
|
||||||
|
|
||||||
<Accordion title="tls.caRef.secretName">
|
|
||||||
The name of the Kubernetes secret containing the CA certificate to use for
|
|
||||||
connecting to the Infisical instance with SSL/TLS.
|
|
||||||
</Accordion>
|
|
||||||
|
|
||||||
<Accordion title="tls.caRef.secretNamespace">
|
|
||||||
The namespace of the Kubernetes secret containing the CA certificate to use
|
|
||||||
for connecting to the Infisical instance with SSL/TLS.
|
|
||||||
</Accordion>
|
|
||||||
|
|
||||||
<Accordion title="tls.caRef.key">
|
|
||||||
The name of the key in the Kubernetes secret which contains the value of the
|
|
||||||
CA certificate to use for connecting to the Infisical instance with SSL/TLS.
|
|
||||||
</Accordion>
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication">
|
<Accordion title="tls.caRef">
|
||||||
This block defines the method that will be used to authenticate with Infisical
|
This block defines the reference to the CA certificate to use for connecting
|
||||||
so that secrets can be fetched
|
to the Infisical instance with SSL/TLS.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.universalAuth">
|
<Accordion title="tls.caRef.secretName">
|
||||||
|
The name of the Kubernetes secret containing the CA certificate to use for
|
||||||
|
connecting to the Infisical instance with SSL/TLS.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="tls.caRef.secretNamespace">
|
||||||
|
The namespace of the Kubernetes secret containing the CA certificate to use
|
||||||
|
for connecting to the Infisical instance with SSL/TLS.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
<Accordion title="tls.caRef.key">
|
||||||
|
The name of the key in the Kubernetes secret which contains the value of the
|
||||||
|
CA certificate to use for connecting to the Infisical instance with SSL/TLS.
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
### Authentication methods
|
||||||
|
|
||||||
|
To retrieve the requested secrets, the operator must first authenticate with Infisical.
|
||||||
|
The list of available authentication methods are shown below.
|
||||||
|
|
||||||
|
<Accordion title="authentication"></Accordion>
|
||||||
|
|
||||||
|
<Accordion title="authentication.universalAuth">
|
||||||
The universal machine identity authentication method is used to authenticate with Infisical. The client ID and client secret needs to be stored in a Kubernetes secret. This block defines the reference to the name and namespace of secret that stores these credentials.
|
The universal machine identity authentication method is used to authenticate with Infisical. The client ID and client secret needs to be stored in a Kubernetes secret. This block defines the reference to the name and namespace of secret that stores these credentials.
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
@@ -196,21 +124,21 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
|
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the project slug
|
Make sure to also populate the `secretsScope` field with the project slug
|
||||||
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
||||||
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
||||||
below.
|
below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
universalAuth:
|
universalAuth:
|
||||||
secretsScope:
|
secretsScope:
|
||||||
@@ -221,11 +149,11 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
secretName: universal-auth-credentials # <-- name of the Kubernetes secret that stores our machine identity credentials
|
secretName: universal-auth-credentials # <-- name of the Kubernetes secret that stores our machine identity credentials
|
||||||
secretNamespace: default # <-- namespace of the Kubernetes secret that stores our machine identity credentials
|
secretNamespace: default # <-- namespace of the Kubernetes secret that stores our machine identity credentials
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.kubernetesAuth">
|
<Accordion title="authentication.kubernetesAuth">
|
||||||
The Kubernetes machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within a Kubernetes environment.
|
The Kubernetes machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within a Kubernetes environment.
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
@@ -349,21 +277,21 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
|
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the project slug
|
Make sure to also populate the `secretsScope` field with the project slug
|
||||||
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
||||||
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
||||||
below.
|
below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml example-kubernetes-auth.yaml
|
```yaml example-kubernetes-auth.yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
kubernetesAuth:
|
kubernetesAuth:
|
||||||
identityId: <machine-identity-id>
|
identityId: <machine-identity-id>
|
||||||
@@ -378,11 +306,11 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
secretsPath: "/path"
|
secretsPath: "/path"
|
||||||
recursive: true
|
recursive: true
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.awsIamAuth">
|
<Accordion title="authentication.awsIamAuth">
|
||||||
The AWS IAM machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within an AWS environment like an EC2 or a Lambda function.
|
The AWS IAM machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within an AWS environment like an EC2 or a Lambda function.
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
@@ -395,21 +323,21 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
|
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the project slug
|
Make sure to also populate the `secretsScope` field with the project slug
|
||||||
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
||||||
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
||||||
below.
|
below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml example-aws-iam-auth.yaml
|
```yaml example-aws-iam-auth.yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
awsIamAuth:
|
awsIamAuth:
|
||||||
identityId: <your-machine-identity-id>
|
identityId: <your-machine-identity-id>
|
||||||
@@ -421,11 +349,11 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
secretsPath: "/path"
|
secretsPath: "/path"
|
||||||
recursive: true
|
recursive: true
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.azureAuth">
|
<Accordion title="authentication.azureAuth">
|
||||||
The Azure machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within an Azure environment.
|
The Azure machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within an Azure environment.
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
@@ -438,21 +366,21 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
|
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the project slug
|
Make sure to also populate the `secretsScope` field with the project slug
|
||||||
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
||||||
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
||||||
below.
|
below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml example-azure-auth.yaml
|
```yaml example-azure-auth.yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
azureAuth:
|
azureAuth:
|
||||||
identityId: <your-machine-identity-id>
|
identityId: <your-machine-identity-id>
|
||||||
@@ -464,11 +392,11 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
secretsPath: "/path"
|
secretsPath: "/path"
|
||||||
recursive: true
|
recursive: true
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.gcpIdTokenAuth">
|
<Accordion title="authentication.gcpIdTokenAuth">
|
||||||
The GCP ID Token machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within GCP environments.
|
The GCP ID Token machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used within GCP environments.
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
@@ -481,21 +409,21 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
|
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the project slug
|
Make sure to also populate the `secretsScope` field with the project slug
|
||||||
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
||||||
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
||||||
below.
|
below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml example-gcp-id-token-auth.yaml
|
```yaml example-gcp-id-token-auth.yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
gcpIdTokenAuth:
|
gcpIdTokenAuth:
|
||||||
identityId: <your-machine-identity-id>
|
identityId: <your-machine-identity-id>
|
||||||
@@ -507,11 +435,11 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
secretsPath: "/path"
|
secretsPath: "/path"
|
||||||
recursive: true
|
recursive: true
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.gcpIamAuth">
|
<Accordion title="authentication.gcpIamAuth">
|
||||||
The GCP IAM machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used both within and outside GCP environments.
|
The GCP IAM machine identity authentication method is used to authenticate with Infisical. The identity ID is stored in a field in the InfisicalSecret resource. This authentication method can only be used both within and outside GCP environments.
|
||||||
|
|
||||||
<Steps>
|
<Steps>
|
||||||
@@ -525,21 +453,21 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
|
|
||||||
</Steps>
|
</Steps>
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the project slug
|
Make sure to also populate the `secretsScope` field with the project slug
|
||||||
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
_`projectSlug`_, environment slug _`envSlug`_, and secrets path
|
||||||
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
_`secretsPath`_ that you want to fetch secrets from. Please see the example
|
||||||
below.
|
below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml example-gcp-id-token-auth.yaml
|
```yaml example-gcp-id-token-auth.yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
gcpIamAuth:
|
gcpIamAuth:
|
||||||
identityId: <your-machine-identity-id>
|
identityId: <your-machine-identity-id>
|
||||||
@@ -552,48 +480,48 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
secretsPath: "/path"
|
secretsPath: "/path"
|
||||||
recursive: true
|
recursive: true
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Accordion title="authentication.serviceToken">
|
<Accordion title="authentication.serviceToken">
|
||||||
|
|
||||||
The service token required to authenticate with Infisical needs to be stored in a Kubernetes secret. This block defines the reference to the name and namespace of secret that stores this service token.
|
The service token required to authenticate with Infisical needs to be stored in a Kubernetes secret. This block defines the reference to the name and namespace of secret that stores this service token.
|
||||||
Follow the instructions below to create and store the service token in a Kubernetes secrets and reference it in your CRD.
|
Follow the instructions below to create and store the service token in a Kubernetes secrets and reference it in your CRD.
|
||||||
|
|
||||||
#### 1. Generate service token
|
#### 1. Generate service token
|
||||||
|
|
||||||
You can generate a [service token](../../documentation/platform/token) for an Infisical project by heading over to the Infisical dashboard then to Project Settings.
|
You can generate a [service token](../../documentation/platform/token) for an Infisical project by heading over to the Infisical dashboard then to Project Settings.
|
||||||
|
|
||||||
#### 2. Create Kubernetes secret containing service token
|
#### 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.
|
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.
|
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.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl create secret generic service-token --from-literal=infisicalToken="<your-service-token-here>"
|
kubectl create secret generic service-token --from-literal=infisicalToken="<your-service-token-here>"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3. Add reference for the Kubernetes secret containing 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 under `authentication.serviceToken.serviceTokenSecretReference` field in the InfisicalSecret resource.
|
Once the secret is created, add the name and namespace of the secret that was just created under `authentication.serviceToken.serviceTokenSecretReference` field in the InfisicalSecret resource.
|
||||||
|
|
||||||
{" "}
|
{" "}
|
||||||
|
|
||||||
<Info>
|
<Info>
|
||||||
Make sure to also populate the `secretsScope` field with the, environment slug
|
Make sure to also populate the `secretsScope` field with the, environment slug
|
||||||
_`envSlug`_, and secrets path _`secretsPath`_ that you want to fetch secrets
|
_`envSlug`_, and secrets path _`secretsPath`_ that you want to fetch secrets
|
||||||
from. Please see the example below.
|
from. Please see the example below.
|
||||||
</Info>
|
</Info>
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: secrets.infisical.com/v1alpha1
|
apiVersion: secrets.infisical.com/v1alpha1
|
||||||
kind: InfisicalSecret
|
kind: InfisicalSecret
|
||||||
metadata:
|
metadata:
|
||||||
name: infisicalsecret-sample-crd
|
name: infisicalsecret-sample-crd
|
||||||
spec:
|
spec:
|
||||||
authentication:
|
authentication:
|
||||||
serviceToken:
|
serviceToken:
|
||||||
serviceTokenSecretReference:
|
serviceTokenSecretReference:
|
||||||
@@ -603,112 +531,155 @@ When `hostAPI` is not defined the operator fetches secrets from Infisical Cloud.
|
|||||||
envSlug: <env-slug> # "dev", "staging", "prod", etc..
|
envSlug: <env-slug> # "dev", "staging", "prod", etc..
|
||||||
secretsPath: <secrets-path> # Root is "/"
|
secretsPath: <secrets-path> # Root is "/"
|
||||||
...
|
...
|
||||||
```
|
|
||||||
|
|
||||||
</Accordion>
|
|
||||||
</Accordion>
|
|
||||||
|
|
||||||
<Accordion title="managedSecretReferences">
|
|
||||||
The `managedSecretReferences` field is used to define the target location(s) 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.
|
|
||||||
|
|
||||||
The `managedSecretReferences` field is an array of objects. Below you can see the structure of the `managedSecretReferences` object.
|
|
||||||
|
|
||||||
Example using a single managed secret reference:
|
|
||||||
```yaml
|
|
||||||
managedSecretReferences:
|
|
||||||
- secretName: managed-secret
|
|
||||||
secretNamespace: default
|
|
||||||
creationPolicy: "Orphan" ## Owner | Orphan
|
|
||||||
# template:
|
|
||||||
# includeAllSecrets: true
|
|
||||||
# data:
|
|
||||||
# CUSTOM_KEY: "{{ .KEY.SecretPath }} {{ .KEY.Value }}"
|
|
||||||
# secretType: kubernetes.io/dockerconfigjson
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: The managed secret be should be created in the same namespace as the deployment that will use it.
|
</Accordion>
|
||||||
<Accordion title="managedSecretReferences.[index].secretName">
|
|
||||||
The name of the managed Kubernetes secret to be created
|
|
||||||
</Accordion>
|
|
||||||
<Accordion title="managedSecretReferences.[index].secretNamespace">
|
|
||||||
The namespace of the managed Kubernetes secret to be created.
|
|
||||||
</Accordion>
|
|
||||||
<Accordion title="managedSecretReferences.[index].secretType">
|
|
||||||
Override the default Opaque type for managed secrets with this field. Useful for creating `kubernetes.io/dockerconfigjson` secrets.
|
|
||||||
</Accordion>
|
|
||||||
<Accordion title="managedSecretReferences.[index].template">
|
|
||||||
Templates enable you to transform data from Infisical before storing it as a Kubernetes Secret.
|
|
||||||
</Accordion>
|
|
||||||
<Accordion title="managedSecretReferences.[index].template.includeAllSecrets">
|
|
||||||
When set to true, this option injects all secrets retrieved from Infisical into your configuration.
|
|
||||||
Secrets defined in the template will override the automatically injected secrets.
|
|
||||||
</Accordion>
|
|
||||||
<Accordion title="managedSecretReferences.[index].template.data">
|
|
||||||
Define secret keys and their corresponding templates.
|
|
||||||
Each data value uses a Golang template with access to all secrets retrieved from the specified scope.
|
|
||||||
|
|
||||||
Secrets are structured as follows:
|
### Operator managed secrets
|
||||||
|
|
||||||
```golang
|
The managed secret properties specify where to store the secrets retrieved from your Infisical project.
|
||||||
type TemplateSecret struct {
|
This includes defining the name and namespace of the Kubernetes secret that will hold these secrets.
|
||||||
|
The Infisical operator will automatically create the Kubernetes secret in the specified name/namespace and ensure it stays up-to-date.
|
||||||
|
|
||||||
|
<Note>
|
||||||
|
|
||||||
|
The `managedSecretReference` field is deprecated and will be removed in a future release.
|
||||||
|
Replace it with `managedSecretReferences`, which now accepts an array of references to support multiple managed secrets in a single InfisicalSecret CRD.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```yaml
|
||||||
|
managedSecretReferences:
|
||||||
|
- secretName: managed-secret
|
||||||
|
secretNamespace: default
|
||||||
|
creationPolicy: "Orphan"
|
||||||
|
```
|
||||||
|
</Note>
|
||||||
|
|
||||||
|
<Accordion title="managedSecretReferences">
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="managedSecretReferences[].secretName">
|
||||||
|
The name of the managed Kubernetes secret to be created
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="managedSecretReferences[].secretNamespace">
|
||||||
|
The namespace of the managed Kubernetes secret to be created.
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="managedSecretReferences[].secretType">
|
||||||
|
Override the default Opaque type for managed secrets with this field. Useful for creating kubernetes.io/dockerconfigjson secrets.
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="managedSecretReferences[].creationPolicy">
|
||||||
|
Creation polices allow you to control whether or not owner references should be added to the managed Kubernetes secret that is generated by the Infisical operator.
|
||||||
|
This is useful for tools such as ArgoCD, where every resource requires an owner reference; otherwise, it will be pruned automatically.
|
||||||
|
|
||||||
|
#### Available options
|
||||||
|
|
||||||
|
- `Orphan` (default)
|
||||||
|
- `Owner`
|
||||||
|
|
||||||
|
<Tip>
|
||||||
|
When creation policy is set to `Owner`, the `InfisicalSecret` CRD must be in
|
||||||
|
the same namespace as where the managed kubernetes secret.
|
||||||
|
</Tip>
|
||||||
|
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
### Manged secret templating
|
||||||
|
|
||||||
|
Fetching secrets from Infisical as is via the operator 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 secrets fetched from Infisical before storing them as Kubernetes Secrets.
|
||||||
|
|
||||||
|
<Accordion title="managedSecretReferences[].template">
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="managedSecretReferences[].template.includeAllSecrets">
|
||||||
|
This property controls what secrets are included in your managed secret when using templates.
|
||||||
|
When set to `true`, all secrets fetched from your Infisical project will be added into your managed Kubernetes secret resource.
|
||||||
|
**Use this option when you would like to sync all secrets from Infisical to Kubernetes but want to template a subset of them.**
|
||||||
|
|
||||||
|
When set to `false`, only secrets defined in the `managedSecretReferences[].template.data` field of the template will be included in the managed secret.
|
||||||
|
Use this option when you would like to sync **only** a subset of secrets from Infisical to Kubernetes.
|
||||||
|
|
||||||
|
</Accordion>
|
||||||
|
<Accordion title="managedSecretReferences[].template.data">
|
||||||
|
Define secret keys and their corresponding templates.
|
||||||
|
Each data value uses a Golang template with access to all secrets retrieved from the specified scope.
|
||||||
|
|
||||||
|
Secrets are structured as follows:
|
||||||
|
|
||||||
|
```golang
|
||||||
|
type TemplateSecret struct {
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
SecretPath string `json:"secretPath"`
|
SecretPath string `json:"secretPath"`
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Example template configuration:
|
#### Example template configuration:
|
||||||
|
|
||||||
```golang
|
```yaml
|
||||||
managedSecretReferences:
|
managedSecretReferences:
|
||||||
- secretName: managed-secret
|
- secretName: managed-secret
|
||||||
secretNamespace: default
|
secretNamespace: default
|
||||||
template:
|
template:
|
||||||
includeAllSecrets: true
|
includeAllSecrets: true
|
||||||
data:
|
data:
|
||||||
NEW_KEY: "{{ .KEY1.SecretPath }} {{ .KEY1.Value }}"
|
# Create new secret key that doesn't exist in your Infisical project using values of other secrets
|
||||||
```
|
NEW_KEY: "{{ .DB_PASSWORD.Value }}"
|
||||||
|
# Override an existing secret key in Infisical project with a new value using values of other secrets
|
||||||
|
API_URL: "https://api.{{.COMPANY_NAME.Value}}.{{.REGION.Value}}.com"
|
||||||
|
```
|
||||||
|
|
||||||
When you run the following command:
|
For this example, let's assume the following secrets exist in your Infisical project:
|
||||||
|
|
||||||
```bash
|
```
|
||||||
kubectl get secret managed-secret -o jsonpath='{.data}'
|
DB_PASSWORD = "secret123"
|
||||||
```
|
COMPANY_NAME = "acme"
|
||||||
|
REGION = "us-east-1"
|
||||||
|
API_URL = "old-url" # This will be overridden
|
||||||
|
```
|
||||||
|
|
||||||
You'll receive Kubernetes secrets output that includes the NEW_KEY:
|
The resulting managed Kubernetes secret will then contain:
|
||||||
|
|
||||||
```bash
|
```
|
||||||
{... "KEY":"d29ybGQ=","NEW_KEY":"LyBoZWxsbw=="}
|
# Original secrets (from includeAllSecrets: true)
|
||||||
```
|
DB_PASSWORD = "secret123"
|
||||||
|
COMPANY_NAME = "acme"
|
||||||
|
REGION = "us-east-1"
|
||||||
|
|
||||||
When you set `includeAllSecrets` as `false` the Kubernetes secrets outputs will be:
|
# New and overridden templated secrets
|
||||||
|
NEW_KEY = "secret123" # New secret created from template
|
||||||
|
API_URL = "https://api.acme.us-east-1.com" # Existing secret overridden by template
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
To help transform your secrets further, the operator provides a set of built-in functions that you can use in your templates.
|
||||||
{"NEW_KEY":"LyBoZWxsbw=="}
|
|
||||||
```
|
|
||||||
|
|
||||||
</Accordion>
|
### Available templating functions
|
||||||
<Accordion title="managedSecretReferences.[index].creationPolicy">
|
|
||||||
Creation polices allow you to control whether or not owner references should be added to the managed Kubernetes secret that is generated by the Infisical operator.
|
|
||||||
This is useful for tools such as ArgoCD, where every resource requires an owner reference; otherwise, it will be pruned automatically.
|
|
||||||
|
|
||||||
#### Available options
|
<Accordion title="decodeBase64ToBytes">
|
||||||
|
**Function name**: decodeBase64ToBytes
|
||||||
|
|
||||||
- `Orphan` (default)
|
**Description**:
|
||||||
- `Owner`
|
Given a base64 encoded string, this function will decodes the base64-encoded string.
|
||||||
|
This function is useful when your secrets are already stored as base64 encoded value in Infisical.
|
||||||
|
|
||||||
<Tip>
|
**Returns**: The decoded base64 string as bytes.
|
||||||
When creation policy is set to `Owner`, the `InfisicalSecret` CRD must be in
|
|
||||||
the same namespace as where the managed kubernetes secret.
|
|
||||||
</Tip>
|
|
||||||
|
|
||||||
</Accordion>
|
**Example**:
|
||||||
|
The example below assumes that the `BINARY_KEY_BASE64` secret is stored as a base64 encoded value in Infisical.
|
||||||
|
The resulting managed secret will contain the decoded value of `BINARY_KEY_BASE64`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
managedSecretReferences:
|
||||||
|
secretName: managed-secret
|
||||||
|
secretNamespace: default
|
||||||
|
template:
|
||||||
|
includeAllSecrets: true
|
||||||
|
data:
|
||||||
|
BINARY_KEY: "{{ decodeBase64ToBytes .BINARY_KEY_BASE64.Value }}"
|
||||||
|
```
|
||||||
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
### Apply the InfisicalSecret CRD to your cluster
|
</Accordion>
|
||||||
|
|
||||||
|
## Applying CRD
|
||||||
|
|
||||||
Once you have configured the InfisicalSecret CRD with the required fields, you can apply it to your cluster.
|
Once you have configured the InfisicalSecret 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.
|
After applying, you should notice that the managed secret has been created in the desired namespace your specified.
|
||||||
@@ -717,8 +688,6 @@ After applying, you should notice that the managed secret has been created in th
|
|||||||
kubectl apply -f example-infisical-secret-crd.yaml
|
kubectl apply -f example-infisical-secret-crd.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
### 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.
|
To verify that the operator has successfully created the managed secret, you can check the secrets in the namespace that was specified.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -733,7 +702,7 @@ kubectl get secrets -n <namespace of managed secret>
|
|||||||
|
|
||||||
## Using managed secret in your deployment
|
## Using managed secret in your deployment
|
||||||
|
|
||||||
Incorporating the managed secret created by the operator into your deployment can be achieved through several methods.
|
To make use of 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 [here](https://kubernetes.io/docs/concepts/configuration/secret/)
|
Here, we will highlight three of the most common ways to utilize it. Learn more about Kubernetes secrets [here](https://kubernetes.io/docs/concepts/configuration/secret/)
|
||||||
|
|
||||||
<Accordion title="envFrom">
|
<Accordion title="envFrom">
|
||||||
|
|||||||
Reference in New Issue
Block a user