Chapter 4. Authenticate with workload identity federation
Configure workload identity federation to allow LokiStack to authenticate with cloud object storage providers without using long-lived credentials.
4.1. Authenticate with workload identity federation to access cloud-based log stores Copy linkLink copied to clipboard!
Use workload identity federation with short-lived tokens to eliminate long-lived credentials.
You can use workload identity federation with short-lived tokens to authenticate to cloud-based log stores. With workload identity federation, you do not have to store long-lived credentials in your cluster, which reduces the risk of credential leaks and simplifies secret management.
Prerequisites
- Your cluster was installed with workload identity federation enabled. Workload identity federation is available on clusters installed with the Cloud Credential Operator in manual mode with short-lived credentials, such as AWS STS, Azure Workload Identity, or GCP Workload Identity Federation. It is not available on clusters that use standard long-lived cloud credentials or on on-site installations.
- You have administrator permissions.
Procedure
Use one of the following options to enable authentication:
-
If you used the OpenShift Container Platform web console to install the Loki Operator, the system automatically detects clusters that use short-lived tokens. You are prompted to create roles and supply the data required for the Loki Operator to create a
CredentialsRequestobject, which populates a secret. If you used the OpenShift CLI (
oc) to install the Loki Operator, you must manually create aSubscriptionobject. Use the appropriate template for your storage provider, as shown in the following samples. This authentication strategy supports only the storage providers indicated within the samples.Microsoft Azure sample subscription
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: loki-operator namespace: openshift-operators-redhat spec: channel: "stable-6.3" installPlanApproval: Manual name: loki-operator source: redhat-operators sourceNamespace: openshift-marketplace config: env: - name: CLIENTID value: <your_client_id> - name: TENANTID value: <your_tenant_id> - name: SUBSCRIPTIONID value: <your_subscription_id> - name: REGION value: <your_region>Amazon Web Services (AWS) sample subscription
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: loki-operator namespace: openshift-operators-redhat spec: channel: "stable-6.3" installPlanApproval: Manual name: loki-operator source: redhat-operators sourceNamespace: openshift-marketplace config: env: - name: ROLEARN value: <role_ARN>Google Cloud (GCP) sample subscription
apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: loki-operator namespace: openshift-operators-redhat spec: channel: "stable-6.3" installPlanApproval: Manual name: loki-operator source: redhat-operators sourceNamespace: openshift-marketplace config: env: - name: PROJECT_NUMBER value: <your_project_number> - name: POOL_ID value: <your_pool_id> - name: PROVIDER_ID value: <your_provider_id> - name: SERVICE_ACCOUNT_EMAIL value: example@mydomain.iam.gserviceaccount.com
-
If you used the OpenShift Container Platform web console to install the Loki Operator, the system automatically detects clusters that use short-lived tokens. You are prompted to create roles and supply the data required for the Loki Operator to create a