Skip to content

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

remove long-lived tokens from v1beta1

Matheus Nogueirae112fb7ee635
diff --git a/docs/integrations/platforms/kubernetes/infisical-auth-crd.mdx b/docs/integrations/platforms/kubernetes/infisical-auth-crd.mdx
index 1f462775e6..34b027135d 100644
--- a/docs/integrations/platforms/kubernetes/infisical-auth-crd.mdx
+++ b/docs/integrations/platforms/kubernetes/infisical-auth-crd.mdx
@@ -28,7 +28,7 @@ Authenticates using a Kubernetes service account token. This is the recommended
[Read more about Kubernetes Auth](/documentation/platform/identities/kubernetes-auth).
-<KubernetesAuthOperatorSetup />
+<KubernetesAuthOperatorSetup apiVersion="v1beta1"/>
| Field | Required | Description |
| ------------------------------ | -------- | --------------------------------------------------------- |
diff --git a/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx b/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx
index 60d7d0f698..3728e2fe63 100644
--- a/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx
+++ b/docs/integrations/platforms/kubernetes/infisical-secret-crd.mdx
@@ -217,7 +217,7 @@ spec:
<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.
- <KubernetesAuthOperatorSetup />
+ <KubernetesAuthOperatorSetup apiVersion="v1alpha1" />
Once you have set up the Kubernetes Auth prerequisites above, add the identity ID and service account details to your InfisicalSecret resource.
In the `authentication.kubernetesAuth.identityId` field, add the identity ID of the machine identity you created.
diff --git a/docs/snippets/documentation/platform/identities/kubernetes-auth-operator-setup.mdx b/docs/snippets/documentation/platform/identities/kubernetes-auth-operator-setup.mdx
index 3ea4dfaf69..04d603fa81 100644
--- a/docs/snippets/documentation/platform/identities/kubernetes-auth-operator-setup.mdx
+++ b/docs/snippets/documentation/platform/identities/kubernetes-auth-operator-setup.mdx
@@ -1,3 +1,5 @@
+export const KubernetesAuthOperatorSetup = ({apiVersion}) => <></>;
+
<Accordion title="Short-lived service account tokens (Recommended)">
<Steps>
<Step title="Create a token reviewer service account">
@@ -130,167 +132,170 @@
</Step>
</Steps>
</Accordion>
-<Accordion title="Manual long-lived service account tokens">
- Manual long-lived service account tokens are created as Kubernetes secrets and remain valid until deleted or rotated. In most cases, use short-lived service account tokens instead because they are easier to operate and reduce the lifetime of exposed credentials.
-
- <Steps>
- <Step title="Create a token reviewer service account">
- Create a reviewer service account in your Kubernetes cluster. Infisical uses this account to authenticate with the Kubernetes API Server through the TokenReview API.
-
- ```yaml infisical-reviewer-service-account.yaml
- apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: infisical-token-reviewer
- namespace: default
- ```
-
- ```bash
- kubectl apply -f infisical-reviewer-service-account.yaml
- ```
- </Step>
-
- <Step title="Bind the reviewer service account">
- Bind the reviewer service account to the `system:auth-delegator` cluster role. This allows Infisical to perform delegated authentication checks against the TokenReview API.
-
- ```yaml infisical-reviewer-cluster-role-binding.yaml
- apiVersion: rbac.authorization.k8s.io/v1
- kind: ClusterRoleBinding
- metadata:
- name: infisical-token-reviewer-role-binding
- namespace: default
- roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: system:auth-delegator
- subjects:
- - kind: ServiceAccount
+{
+apiVersion === 'v1alpha1' ?
+(<Accordion title="Manual long-lived service account tokens">
+ Manual long-lived service account tokens are created as Kubernetes secrets and remain valid until deleted or rotated. In most cases, use short-lived service account tokens instead because they are easier to operate and reduce the lifetime of exposed credentials.
+
+ <Steps>
+ <Step title="Create a token reviewer service account">
+ Create a reviewer service account in your Kubernetes cluster. Infisical uses this account to authenticate with the Kubernetes API Server through the TokenReview API.
+
+ ```yaml infisical-reviewer-service-account.yaml
+ apiVersion: v1
+ kind: ServiceAccount
+ metadata:
name: infisical-token-reviewer
namespace: default
- ```
+ ```
- ```bash
- kubectl apply -f infisical-reviewer-cluster-role-binding.yaml
- ```
- </Step>
+ ```bash
+ kubectl apply -f infisical-reviewer-service-account.yaml
+ ```
+ </Step>
- <Step title="Create and retrieve the token reviewer JWT">
- Create a service account token secret for the reviewer service account:
-
- ```yaml service-account-reviewer-token.yaml
- apiVersion: v1
- kind: Secret
- type: kubernetes.io/service-account-token
- metadata:
- name: infisical-token-reviewer-token
- annotations:
- kubernetes.io/service-account.name: "infisical-token-reviewer"
- ```
+ <Step title="Bind the reviewer service account">
+ Bind the reviewer service account to the `system:auth-delegator` cluster role. This allows Infisical to perform delegated authentication checks against the TokenReview API.
- ```bash
- kubectl apply -f service-account-reviewer-token.yaml
- ```
-
- Link the secret to the reviewer service account:
-
- ```bash
- kubectl patch serviceaccount infisical-token-reviewer \
- -p '{"secrets": [{"name": "infisical-token-reviewer-token"}]}' \
- -n default
- ```
+ ```yaml infisical-reviewer-cluster-role-binding.yaml
+ apiVersion: rbac.authorization.k8s.io/v1
+ kind: ClusterRoleBinding
+ metadata:
+ name: infisical-token-reviewer-role-binding
+ namespace: default
+ roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: system:auth-delegator
+ subjects:
+ - kind: ServiceAccount
+ name: infisical-token-reviewer
+ namespace: default
+ ```
- Retrieve the token reviewer JWT:
+ ```bash
+ kubectl apply -f infisical-reviewer-cluster-role-binding.yaml
+ ```
+ </Step>
- ```bash
- kubectl get secret infisical-token-reviewer-token \
- -n default \
- -o=jsonpath='{.data.token}' | base64 --decode
- ```
+ <Step title="Create and retrieve the token reviewer JWT">
+ Create a service account token secret for the reviewer service account:
- Keep this JWT token handy. You will need it for the **Token Reviewer JWT** field when configuring Kubernetes Auth on the machine identity in Infisical.
- </Step>
+ ```yaml service-account-reviewer-token.yaml
+ apiVersion: v1
+ kind: Secret
+ type: kubernetes.io/service-account-token
+ metadata:
+ name: infisical-token-reviewer-token
+ annotations:
+ kubernetes.io/service-account.name: "infisical-token-reviewer"
+ ```
- <Step title="Create a machine identity">
- To create an identity, head to your Organization Settings > Access Control > Identities and press **Create identity**.
+ ```bash
+ kubectl apply -f service-account-reviewer-token.yaml
+ ```
- ![identities organization](/images/platform/identities/identities-org.png)
+ Link the secret to the reviewer service account:
- When creating an identity, you specify an organization level [role](/documentation/platform/access-controls/role-based-access-controls) for it to assume; you can configure roles in Organization Settings > Access Control > Organization Roles.
+ ```bash
+ kubectl patch serviceaccount infisical-token-reviewer \
+ -p '{'{'}"secrets": [{'{'}"name": "infisical-token-reviewer-token"{'}'}]{'}'}' \
+ -n default
+ ```
- ![identities organization create](/images/platform/identities/identities-org-create.png)
+ Retrieve the token reviewer JWT:
- Now input a few details for your new identity. Here's some guidance for each field:
+ ```bash
+ kubectl get secret infisical-token-reviewer-token \
+ -n default \
+ -o=jsonpath='{'{'}.data.token{'}'}' | base64 --decode
+ ```
- - 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.
+ Keep this JWT token handy. You will need it for the **Token Reviewer JWT** field when configuring Kubernetes Auth on the machine identity in Infisical.
+ </Step>
- Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **Kubernetes Auth**.
+ <Step title="Create a machine identity">
+ To create an identity, head to your Organization Settings {'>'} Access Control {'>'} Identities and press **Create identity**.
- Use the token reviewer JWT from the previous step when filling the **Token Reviewer JWT** field.
+ ![identities organization](/images/platform/identities/identities-org.png)
- <Info>
- To learn more about each field of the Kubernetes native authentication method, see step 2 of [guide](/documentation/platform/identities/kubernetes-auth#guide).
- </Info>
+ When creating an identity, you specify an organization level [role](/documentation/platform/access-controls/role-based-access-controls) for it to assume; you can configure roles in Organization Settings {'>'} Access Control {'>'} Organization Roles.
- ![identities organization create auth method](/images/platform/identities/identities-org-create-kubernetes-auth-method.png)
- </Step>
+ ![identities organization create](/images/platform/identities/identities-org-create.png)
- <Step title="Add the identity to a project">
- To allow the operator to use the given identity to access secrets, you will need to add the identity to project(s) that you would like to grant it access to.
+ Now input a few details for your new identity. Here's some guidance for each field:
- To do this, head over to the project you want to add the identity to and go to Project Settings > Access Control > Machine Identities and press **Add identity**.
+ - 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.
- Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to.
+ Once you've created an identity, you'll be prompted to configure the authentication method for it. Here, select **Kubernetes Auth**.
- ![identities project](/images/platform/identities/identities-project.png)
+ Use the token reviewer JWT from the previous step when filling the **Token Reviewer JWT** field.
- ![identities project create](/images/platform/identities/identities-project-create.png)
- </Step>
+ <Info>
+ To learn more about each field of the Kubernetes native authentication method, see step 2 of [guide](/documentation/platform/identities/kubernetes-auth#guide).
+ </Info>
- <Step title="Create the service account used for authentication">
- Create the Kubernetes service account that the operator will use to authenticate with Infisical.
+ ![identities organization create auth method](/images/platform/identities/identities-org-create-kubernetes-auth-method.png)
+ </Step>
- ```yaml infisical-service-account.yaml
- apiVersion: v1
- kind: ServiceAccount
- metadata:
- name: infisical-service-account
- namespace: default
- ```
+ <Step title="Add the identity to a project">
+ To allow the operator to use the given identity to access secrets, you will need to add the identity to project(s) that you would like to grant it access to.
- ```bash
- kubectl apply -f infisical-service-account.yaml
- ```
- </Step>
+ To do this, head over to the project you want to add the identity to and go to Project Settings {'>'} Access Control {'>'} Machine Identities and press **Add identity**.
- <Step title="Create a long-lived token for the service account">
- Create a service account token secret for the service account used to authenticate with Infisical:
+ Next, select the identity you want to add to the project and the project level role you want to allow it to assume. The project role assigned will determine what project level resources this identity can have access to.
- ```yaml infisical-service-account-token.yaml
- apiVersion: v1
- kind: Secret
- type: kubernetes.io/service-account-token
- metadata:
- name: infisical-service-account-token
- namespace: default
- annotations:
- kubernetes.io/service-account.name: "infisical-service-account"
- ```
+ ![identities project](/images/platform/identities/identities-project.png)
- ```bash
- kubectl apply -f infisical-service-account-token.yaml
- ```
+ ![identities project create](/images/platform/identities/identities-project-create.png)
+ </Step>
- Patch the service account with the newly created service account token:
+ <Step title="Create the service account used for authentication">
+ Create the Kubernetes service account that the operator will use to authenticate with Infisical.
- ```bash
- kubectl patch serviceaccount infisical-service-account \
- -p '{"secrets": [{"name": "infisical-service-account-token"}]}' \
- -n default
- ```
- </Step>
- </Steps>
-</Accordion>
+ ```yaml infisical-service-account.yaml
+ apiVersion: v1
+ kind: ServiceAccount
+ metadata:
+ name: infisical-service-account
+ namespace: default
+ ```
+
+ ```bash
+ kubectl apply -f infisical-service-account.yaml
+ ```
+ </Step>
+
+ <Step title="Create a long-lived token for the service account">
+ Create a service account token secret for the service account used to authenticate with Infisical:
+
+ ```yaml infisical-service-account-token.yaml
+ apiVersion: v1
+ kind: Secret
+ type: kubernetes.io/service-account-token
+ metadata:
+ name: infisical-service-account-token
+ namespace: default
+ annotations:
+ kubernetes.io/service-account.name: "infisical-service-account"
+ ```
+
+ ```bash
+ kubectl apply -f infisical-service-account-token.yaml
+ ```
+
+ Patch the service account with the newly created service account token:
+
+ ```bash
+ kubectl patch serviceaccount infisical-service-account \
+ -p '{'{'}"secrets": [{'{'}"name": "infisical-service-account-token"{'}'}]{'}'}' \
+ -n default
+ ```
+ </Step>
+ </Steps>
+</Accordion>) : (<></>)
+}
<Accordion title="Use Gateway as Reviewer">
<Note>
**When to use this option**: Choose this approach when you have a gateway deployed in your Kubernetes Cluster and wish to eliminate long-lived tokens. This approach simplifies Infisical Kubernetes Auth configuration, and only one service account will need to have the elevated `system:auth-delegator` ClusterRole binding.