|
3 | 3 | //* observability/distr_tracing/distr-tracing-tempo-installing.adoc
|
4 | 4 |
|
5 | 5 | :_mod-docs-content-type: PROCEDURE
|
6 |
| -[id="distr-tracing-tempo-object-storage-setup-azure-sts-install_{context}"] |
| 6 | +[id="setting-up-azure-storage-with-security-token-service_{context}"] |
7 | 7 | = Setting up the Azure storage with the Security Token Service
|
8 | 8 |
|
9 |
| -You can set up Azure storage with the Security Token Service (STS) by using the Azure Command Line Interface (AZ CLI). |
| 9 | +You can set up the Azure storage with the Security Token Service (STS) by using the Azure Command Line Interface (Azure CLI). |
10 | 10 |
|
11 | 11 | :FeatureName: Azure storage with the Security Token Service
|
12 | 12 | include::snippets/technology-preview.adoc[leveloffset=+1]
|
13 | 13 |
|
14 | 14 | .Prerequisites
|
15 | 15 |
|
16 |
| -* You have installed the latest version of the AWS CLI. |
17 |
| -* Created an Azure Storage Account. |
18 |
| -* Created an Azure Blob Storage Container. |
| 16 | +* You have installed the latest version of the Azure CLI. |
| 17 | +* You have created an Azure storage account. |
| 18 | +* You have created an Azure blob storage container. |
19 | 19 |
|
20 | 20 | .Procedure
|
21 |
| -. Create an Azure Managed identity |
| 21 | + |
| 22 | +. Create an Azure managed identity: |
| 23 | ++ |
22 | 24 | [source,terminal]
|
23 | 25 | ----
|
24 |
| -az identity create \ |
25 |
| - --name <IDENTITY_NAME> \ <1> |
26 |
| - --resource-group <RESOURCE_GROUP> \ <2> |
27 |
| - --location <REGION> \ <3> |
28 |
| - --subscription <SUBSCRIPTION_ID> <4> |
| 26 | +$ az identity create \ |
| 27 | + --name <identity_name> \ # <1> |
| 28 | + --resource-group <resource_group> \ # <2> |
| 29 | + --location <region> \ # <3> |
| 30 | + --subscription <subscription_id> # <4> |
29 | 31 | ----
|
30 |
| -<1> Name of the identity to be created. |
31 |
| -<2> The Azure resource group where the identity will be created. |
32 |
| -<3> The Azure region; it should be the same region as the resource group. |
| 32 | +<1> Choose a name for the managed identity. |
| 33 | +<2> The Azure resource group where the identity is to be created. |
| 34 | +<3> The Azure region, which must be the same region as for the resource group. |
33 | 35 | <4> Azure subscription ID.
|
| 36 | + |
| 37 | +. Create a federated identity credential for the Kubernetes service account for use by all components except the frontend component: |
34 | 38 | +
|
35 |
| -. Create federated credentials. Federated credentials allow Kubernetes service accounts to authenticate as the Azure managed identity without storing secrets or using service principals. You need to create one per Kubernetes service account. In this case, the operator will create one service account for all components and one specific for the frontend component. |
36 | 39 | [source,terminal]
|
37 | 40 | ----
|
38 |
| -az identity federated-credential create \ |
39 |
| - --name <CREDENTIAL_NAME> \ <1> |
40 |
| - --identity-name <IDENTITY_NAME> \ |
41 |
| - --resource-group <RESOURCE_GROUP> \ |
42 |
| - --issuer <CLUSTER_ISSUER> \ <2> |
43 |
| - --subject <TEMPO_SA_SUBJECT> \ <3> |
44 |
| - --audiences <AUDIENCE> <4> |
45 |
| ----- |
46 |
| -<1> Name of the federated credential. |
47 |
| -<2> The OIDC issuer URL of the Kubernetes cluster. You can get it using the following command: `oc get authentication cluster -o json | jq -r .spec.serviceAccountIssuer` |
48 |
| -<3> The Kubernetes service account subject, in the format: `system:serviceaccount:<namespace>:tempo-<tempo-instance-name>` |
49 |
| -<4> The expected audience used to validate tokens, commonly set to `api://AzureADTokenExchange`. |
| 41 | +$ az identity federated-credential create \ # <1> |
| 42 | + --name <credential_name> \ # <2> |
| 43 | + --identity-name <identity_name> \ |
| 44 | + --resource-group <resource_group> \ |
| 45 | + --issuer <cluster_issuer> \ # <3> |
| 46 | + --subject <tempo_sa_subject> \ # <4> |
| 47 | + --audiences <audience> # <5> |
| 48 | +---- |
| 49 | +<1> Federated identity credentials allow Kubernetes service accounts to authenticate as an Azure managed identity without storing secrets or using an Azure service principal identity. |
| 50 | +<2> Choose a name for the federated credential. |
| 51 | +<3> The URL of the OpenID Connect (OIDC) issuer for your cluster. |
| 52 | +<4> The service account subject for your cluster in the following format: `system:serviceaccount:<namespace>:tempo-<tempostack_instance_name>`. |
| 53 | +<5> The expected audience, which is to be used for validating the issued tokens for the federated identity credential. This is commonly set to `api://AzureADTokenExchange`. |
| 54 | ++ |
| 55 | +[TIP] |
| 56 | +==== |
| 57 | +You can get the URL of the OpenID Connect (OIDC) issuer for your cluster by running the following command: |
| 58 | +---- |
| 59 | +$ oc get authentication cluster -o json | jq -r .spec.serviceAccountIssuer |
| 60 | +---- |
| 61 | +==== |
| 62 | +
|
| 63 | +. Create a federated identity credential for the Kubernetes service account for use by the frontend component: |
50 | 64 | +
|
51 |
| -Create frontend federated credential. |
52 | 65 | [source,terminal]
|
53 | 66 | ----
|
54 |
| -az identity federated-credential create \ |
55 |
| - --name <CREDENTIAL_NAME>-frontend \ <1> |
56 |
| - --identity-name <IDENTITY_NAME> \ |
57 |
| - --resource-group <RESOURCE_GROUP> \ |
58 |
| - --issuer <CLUSTER_ISSUER> \ |
59 |
| - --subject <TEMPO_SA_QUERY_FRONTEND_SUBJECT> \ <2> |
60 |
| - --audiences <AUDIENCE> | jq |
| 67 | +$ az identity federated-credential create \ # <1> |
| 68 | + --name <credential_name>-frontend \ # <2> |
| 69 | + --identity-name <identity_name> \ |
| 70 | + --resource-group <resource_group> \ |
| 71 | + --issuer <cluster_issuer> \ |
| 72 | + --subject <tempo_sa_query_frontend_subject> \ # <3> |
| 73 | + --audiences <audience> | jq |
61 | 74 | ----
|
62 |
| -<1> Name of the federated credential. |
63 |
| -<2> The Kubernetes service account subject, in the format: `system:serviceaccount:<namespace>:tempo-<tempo-instance-name>` |
| 75 | +<1> Federated identity credentials allow Kubernetes service accounts to authenticate as an Azure managed identity without storing secrets or using an Azure service principal identity. |
| 76 | +<2> Choose a name for the frontend federated identity credential. |
| 77 | +<3> The service account subject for your cluster in the following format: `system:serviceaccount:<namespace>:tempo-<tempostack_instance_name>`. |
| 78 | +
|
| 79 | +. Assign the Storage Blob Data Contributor role to the Azure service principal identity of your created Azure managed identity: |
64 | 80 | +
|
65 |
| -. Assign the "Storage Blob Data Contributor" role to the managed identity's service principal. |
66 | 81 | [source,terminal]
|
67 | 82 | ----
|
68 |
| -az role assignment create \ |
69 |
| - --assignee <ASSIGNEE_NAME> \ <1> |
| 83 | +$ az role assignment create \ |
| 84 | + --assignee <assignee_name> \ # <1> |
70 | 85 | --role "Storage Blob Data Contributor" \
|
71 |
| - --scope "/subscriptions/<SUBSCRIPTION_ID> |
| 86 | + --scope "/subscriptions/<subscription_id> |
72 | 87 | ----
|
73 |
| -<1> Managed identity principal. Can be obtained with the following command: `az ad sp list --all --filter "servicePrincipalType eq 'ManagedIdentity'" | jq -r --arg idName <IDENTITY_NAME> '.[] | select(.displayName == $idName) | .appId'` |
| 88 | +<1> The Azure service principal identity of the Azure managed identity that you created in step 1. |
74 | 89 | +
|
75 |
| -. Fetch the client ID of the existing managed identity. |
76 |
| -[source,terminal] |
| 90 | +[TIP] |
| 91 | +==== |
| 92 | +You can get the `<assignee_name>` value by running the following command: |
| 93 | +---- |
| 94 | +$ az ad sp list --all --filter "servicePrincipalType eq 'ManagedIdentity'" | jq -r --arg idName <identity_name> '.[] | select(.displayName == $idName) | .appId'` |
| 95 | +---- |
| 96 | +==== |
| 97 | +
|
| 98 | +. Fetch the client ID of the Azure managed identity that you created in step 1: |
| 99 | ++ |
| 100 | +[source,bash] |
77 | 101 | ----
|
78 | 102 | CLIENT_ID=$(az identity show \
|
79 |
| - --name <IDENTITY_NAME> \ |
80 |
| - --resource-group <RESOURCE_GROUP> \ |
| 103 | + --name <identity_name> \ # <1> |
| 104 | + --resource-group <resource_group> \ # <2> |
81 | 105 | --query clientId \
|
82 | 106 | -o tsv)
|
83 | 107 | ----
|
| 108 | +<1> Copy and paste the `<identity_name>` value from step 1. |
| 109 | +<2> Copy and paste the `<resource_group>` value from step 1. |
| 110 | +
|
| 111 | +. Create a Kubernetes secret for the Azure workload identity federation (WIF): |
84 | 112 | +
|
85 |
| -. Create a Kubernetes secret for Azure WIF. |
86 | 113 | [source,terminal]
|
87 | 114 | ----
|
88 |
| -kubectl create -n <TEMPO_NAMESPACE> secret generic azure-secret \ |
89 |
| - --from-literal=container=<$AZURE_STORAGE_AZURE_CONTAINER> \ <1> |
90 |
| - --from-literal=account_name=<AZURE_STORAGE_AZURE_ACCOUNTNAME> \ <2> |
91 |
| - --from-literal=client_id=<CLIENT_ID> \ <3> |
92 |
| - --from-literal=audience=<AUDIENCE> \ <4> |
93 |
| - --from-literal=tenant_id=<TENANT_ID> <5> |
94 |
| ----- |
95 |
| -<1> Azure Blob storage container. |
96 |
| -<2> Azure Storage account name. |
97 |
| -<3> Client ID of the managed identity (obtained in the previous step). |
98 |
| -<4> Audience, optional (defaults to `api://AzureADTokenExchange`). |
99 |
| -<5> Azure Tenant ID. |
| 115 | +$ kubectl create -n <tempo_namespace> secret generic azure-secret \ |
| 116 | + --from-literal=container=<azure_storage_azure_container> \ # <1> |
| 117 | + --from-literal=account_name=<azure_storage_azure_accountname> \ # <2> |
| 118 | + --from-literal=client_id=<client_id> \ # <3> |
| 119 | + --from-literal=audience=<audience> \ # <4> |
| 120 | + --from-literal=tenant_id=<tenant_id> # <5> |
| 121 | +---- |
| 122 | +<1> The name of the Azure Blob Storage container. |
| 123 | +<2> The name of the Azure Storage account. |
| 124 | +<3> The client ID of the managed identity that you fetched in the previous step. |
| 125 | +<4> Optional: Defaults to `api://AzureADTokenExchange`. |
| 126 | +<5> Azure Tenant ID. |
0 commit comments