Skip to content

Commit 0461e55

Browse files
committed
Revise doc and use new screenshots
1 parent 0b1e307 commit 0461e55

File tree

5 files changed

+80
-135
lines changed

5 files changed

+80
-135
lines changed

articles/azure-app-configuration/integrate-ci-cd-pipeline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ To do a cloud build, with Azure DevOps for example, make sure the [Azure CLI](ht
9393
In this tutorial, you exported Azure App Configuration data to be used in a deployment pipeline. To learn more about how to use App Configuration, continue to the Azure CLI samples.
9494

9595
> [!div class="nextstepaction"]
96-
> [Managed identity integration](./howto-integrate-azure-managed-service-identity.md)
96+
> [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/appconfig?view=azure-cli-latest)

articles/azure-app-configuration/integrate-kubernetes-deployment-helm.md

Lines changed: 78 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: "Integrate Azure App Configuration with Kubernetes Deployment using Helm"
33
description: Learn how to use dynamic configurations in Kubernetes deployment with Helm.
44
services: azure-app-configuration
5-
author: shuawan
6-
manager: zhenlwa
5+
author: shenmuxiaosen
6+
manager: zhenlan
77

88
ms.service: azure-app-configuration
99
ms.topic: tutorial
@@ -14,21 +14,49 @@ ms.author: shuawan
1414
---
1515
# Integrate with Kubernetes Deployment Using Helm
1616

17-
This article explains how to use data from Azure App Configuration in Kubernetes deployment with Helm.
17+
In this tutorial, we will use a sample Helm chart and show how to generate configurations and secrets from the App Configuration that can be used in Kubernetes deployment.
1818

1919
## Prerequisites
2020

2121
- [!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
22-
- Install [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest)
23-
- Install [Helm](https://helm.sh/docs/intro/install/)
24-
- Background knowledge for installing applications with Helm in [Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/kubernetes-helm)
22+
- Install [Azure CLI](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest) (version 2.4.0 or later)
23+
- Install [Helm](https://helm.sh/docs/intro/install/) (version 2.14.0 or later)
24+
- A Kubernetes cluster.
25+
26+
This tutorial assumes basic understanding of managing Kubernetes with Helm. Learn more about installing applications with Helm in [Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/kubernetes-helm).
27+
28+
## Create an App Configuration store
29+
30+
[!INCLUDE [azure-app-configuration-create](../../includes/azure-app-configuration-create.md)]
31+
32+
6. Select **Configuration Explorer** > **Create** to add the following key-value pairs:
33+
34+
| Key | Value |
35+
|---|---|
36+
| settings.color | White |
37+
| settings.message | Data from Azure App Configuration |
38+
39+
Leave **Label** and **Content Type** empty for now.
40+
41+
## Add a Key Vault reference to App Configuration
42+
1. Sign in to the [Azure portal](https://portal.azure.com) and add a secret to [Key Vault](https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-portal#add-a-secret-to-key-vault) with name **Password** and value **myPassword**.
43+
2. Select the App Configuration store instance that you created in previous section.
44+
45+
1. Select **Configuration Explorer**.
46+
47+
1. Select **+ Create** > **Key vault reference**, and then specify the following values:
48+
- **Key**: Select **secrets.password**.
49+
- **Label**: Leave this value blank.
50+
- **Subscription**, **Resource group**, and **Key vault**: Enter the values corresponding to those in the key vault you created in previous step.
51+
- **Secret**: Select the secret named **Password** that you created in the previous section.
2552

2653
## Create Helm chart ##
27-
```powershell
28-
# Create sample Helm chart
54+
First, we will create a sample Helm chart with the following command
55+
```console
2956
helm create mychart
3057
```
31-
Helm will create a new directory in your project called mychart with the structure shown below.
58+
59+
Helm will create a new directory called mychart with the structure shown below. You can follow the [charts guide](https://helm.sh/docs/chart_template_guide/getting_started/) to learn more.
3260
```
3361
mychart
3462
|-- Chart.yaml
@@ -42,19 +70,17 @@ mychart
4270
`-- values.yaml
4371
```
4472

45-
Details to understand [mychart](https://helm.sh/docs/chart_template_guide/getting_started/)
46-
47-
Based on the sample **deployment.yaml** file, we modify the chart to add some environment variables to container under ```spec:template:spec:containers```. Although this setting won't be used by the application, it shows as an example for how to dynamically pass configurations into Helm deployment.
73+
Next, we will update the *deployment.yaml* file and add the following snippet which adds two environment variables to the container under **spec:template:spec:containers**. It shows how to dynamically pass configurations into deployment.
4874

4975
```yaml
5076
env:
5177
- name: Color
52-
value: {{ .Values.color }}
78+
value: {{ .Values.settings.color }}
5379
- name: Message
54-
value: {{ .Values.message }}
80+
value: {{ .Values.settings.message }}
5581
```
5682
57-
The modified deployment.yaml should look like below.
83+
The complete *deployment.yaml* file after the update should look like below.
5884
5985
```yaml
6086
apiVersion: apps/v1beta2
@@ -84,9 +110,9 @@ spec:
84110
imagePullPolicy: {{ .Values.image.pullPolicy }}
85111
env:
86112
- name: Color
87-
value: {{ .Values.color }}
113+
value: {{ .Values.settings.color }}
88114
- name: Message
89-
value: {{ .Values.message }}
115+
value: {{ .Values.settings.message }}
90116
ports:
91117
- name: http
92118
containerPort: 80
@@ -115,146 +141,65 @@ spec:
115141
{{- end }}
116142
```
117143

118-
In addition, add **secrets.yaml** under templates for Kubernetes Secrets, which is used to store and manage sensitive information, such as passwords. Same with environment variables, Secrets can also be referenced by application.
144+
Then we add a *secrets.yaml* file under the templates folder with following content. It will be used to store Kubernetes Secrets, such as passwords. The secrets will be accessible from inside the container. Learn more about how to use [Kubernetes Secrets](https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets).
145+
119146
```yaml
120147
apiVersion: v1
121148
kind: Secret
122149
metadata:
123150
name: mysecret
124151
type: Opaque
125152
data:
126-
password: {{ .Values.password }}
153+
password: {{ .Values.secrets.password }}
127154
```
128155
129-
In **values.yaml**, there are some default settings used for chart. Let's add some place holder for configurations we added above. Settings in **values.yaml** can be later on combined and overwritten by configurations pulled from App Configuration.
156+
Finally, we can update the *values.yaml* file with the following content to optionally provide default values of the configuration settings and secrets that we referenced in the *deployment.yaml* and *secrets.yaml* files earlier. Their actual values will be overwritten by configuration pulled from the App Configuration.
130157
131158
```yaml
132-
# Default values for mychart.
133-
# This is a YAML-formatted file.
134-
# Declare variables to be passed into your templates.
135-
136-
replicaCount: 1
137-
138-
image:
139-
repository: nginx
140-
tag: stable
141-
pullPolicy: IfNotPresent
142-
143-
nameOverride: ""
144-
fullnameOverride: ""
145-
146-
service:
147-
type: ClusterIP
148-
port: 80
149-
150-
ingress:
151-
enabled: false
152-
annotations: {}
153-
# kubernetes.io/ingress.class: nginx
154-
# kubernetes.io/tls-acme: "true"
155-
path: /
156-
hosts:
157-
- chart-example.local
158-
tls: []
159-
# - secretName: chart-example-tls
160-
# hosts:
161-
# - chart-example.local
162-
163-
resources: {}
164-
# We usually recommend not to specify default resources and to leave this as a conscious
165-
# choice for the user. This also increases chances charts run on environments with little
166-
# resources, such as Minikube. If you do want to specify resources, uncomment the following
167-
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
168-
# limits:
169-
# cpu: 100m
170-
# memory: 128Mi
171-
# requests:
172-
# cpu: 100m
173-
# memory: 128Mi
174-
175-
nodeSelector: {}
176-
177-
tolerations: []
178-
179-
affinity: {}
180-
181159
# settings will be overwritten by App Configuration
182-
color: red
183-
message: myMessage
184-
185-
password: null
160+
settings:
161+
color: red
162+
message: myMessage
186163
```
187164

188-
## Create an App Configuration store
189-
190-
[!INCLUDE [azure-app-configuration-create](../../includes/azure-app-configuration-create.md)]
191-
192-
6. Select **Configuration Explorer** > **Create** to add the following key-value pairs:
193-
194-
| Key | Value |
195-
|---|---|
196-
| color | White |
197-
| message | Data from Azure App Configuration |
198-
199-
Leave **Label** and **Content Type** empty for now.
200-
201-
## Add a secret to Key Vault
202-
203-
To add a secret to the vault, you need to take just a few additional steps. In this case, add a message that you can use to test Key Vault retrieval. The message is called **Message**, and you store the value "Hello from Key Vault" in it.
204-
205-
1. From the Key Vault properties pages, select **Secrets**.
206-
1. Select **Generate/Import**.
207-
1. In the **Create a secret** pane, enter the following values:
208-
- **Upload options**: Enter **Manual**.
209-
- **Name**: Enter **Password**.
210-
- **Value**: Enter **myPassword**.
211-
1. Leave the other **Create a secret** properties with their default values.
212-
1. Select **Create**.
213-
214-
## Add a Key Vault reference to App Configuration
215-
216-
1. Sign in to the [Azure portal](https://portal.azure.com). Select **All resources**, and then select the App Configuration store instance that you created in the quickstart.
217-
218-
1. Select **Configuration Explorer**.
219-
220-
1. Select **+ Create** > **Key vault reference**, and then specify the following values:
221-
- **Key**: Select **KVRef_password**.
222-
- **Label**: Leave this value blank.
223-
- **Subscription**, **Resource group**, and **Key vault**: Enter the values corresponding to those in the key vault you created in the previous section.
224-
- **Secret**: Select the secret named **Password** that you created in the previous section.
165+
## Pass configuration data from App Configuration during Helm install ##
166+
First, we download the configuration from App Configuration to a *myConfig.yaml* file. We use a key filter to only download those keys that start with **settings.**. If in your case the key filter is not sufficient to exclude keys of Key Vault references, you may use the argument **--skip-keyvault** to exclude them. Learn more about the [export command](https://docs.microsoft.com/en-us/cli/azure/appconfig/kv?view=azure-cli-latest#az-appconfig-kv-export).
167+
```azurecli-interactive
168+
az appconfig kv export -n myAppConfiguration -d file --path myConfig.yaml --key "settings.*" --separator "." --format yaml
169+
```
225170

226-
## Merge data from App Configuration ##
227-
In App Configuration, there are normal configurations along with key vault references and if no need to resolve those references in deployment time, then pull all data in one shot.
228-
```PowerShell
229-
$ConfigFilePath="config.yaml"
171+
Then we download secrets to a *mySecrets.yaml* file. Note the parameter **--resolve-keyvault** is used so the Key Vault references will be resolved and the actual values in the Key Vault will be retrieved. Make sure the credential that is used to run this command has access permission to the corresponding Key Vault. As this file contains sensitive information, keep the file with care and clean up when it's not needed anymore.
172+
```azurecli-interactive
173+
az appconfig kv export -n myAppConfiguration -d file --path mySecrets.yaml --key "secrets.*" --separator "." --resolve-keyvault --format yaml
174+
```
230175

231-
# Export configurations to local files
232-
az appconfig kv export -n myAppConfiguration -d file --path config.yaml --format yaml -y
176+
In the end, pass those two files during Helm install with argument **-f** to overwrite *values.yaml*.
177+
```console
178+
helm upgrade --install -f myConfig.yaml -f mySecrets.yaml "example" ./mychart
233179
```
234180

235-
If there is a need to resolve the content of key vault references like secrets, then separate them into two files.
236-
```PowerShell
237-
$ConfigFilePath=config.yaml
238-
$SecretPath=secrets.yaml
181+
If there is a concern for putting sensitive data in persistent storage, export content of key vault references to memory. Besides files Helm also allows passing literal key values with argument **--set**. Learn more about [Helm usage](https://helm.sh/docs/intro/using_helm/).
239182

240-
# Export configurations excluding key vault reference to local files
241-
az appconfig kv export -n myAppConfiguration -d file --path $ConfigFilePath --skip-keyvault --format yaml -y
183+
```powershell
184+
$secrets = az appconfig kv list -n myAppConfiguration1157 --key "secrets.*" --resolve-keyvault --query "[*].{name:key, value:value}" | ConvertFrom-Json
242185
243-
# Export content of key vault references to local files
244-
az appconfig kv export --key "KVRef_*" --prefix "KVRef_" -n myAppConfiguration -d file --path $SecretPath --resolve-keyvault --format yaml -y
186+
foreach ($secret in $secrets) {
187+
$keyvaules += $secret.name + "=" + $secret.value + ","
188+
}
245189
246-
# Export content of key vault references to memory if there is concern for putting sensitive data in persistent storage.
247-
$data = az appconfig kv list --key "KVRef_*" -n myAppConfiguration --resolve-keyvault
248-
```
190+
if ($keyvaules){
191+
$keyvaules = $keyvaules.TrimEnd(',')
192+
helm upgrade --install --set $keyvaules "example" ./mychart
193+
}
194+
else{
195+
helm upgrade --install "example" ./mychart
196+
}
249197
250-
There are [two ways](https://helm.sh/docs/intro/using_helm/) to pass configuration data during helm install. Helm allow passing files or literal key values to overwrite settings specified in values.yaml.
251-
```PowerShell
252-
# Deploy the helm chart.
253-
helm upgrade --install -f $ConfigFilePath -f $SecretPath --set service.type=NodePort "example" ./mychart
254198
```
255199

256-
We can verify by accessing [Kubernetes Dashboard](https://docs.microsoft.com/azure/aks/kubernetes-dashboard)
200+
We can verify configurations and secrets are successfully pulled by accessing [Kubernetes Dashboard](https://docs.microsoft.com/azure/aks/kubernetes-dashboard). Two settings, **color** and **message**, stores in App Configuration were populated into container's environment variables.
257201
![Quickstart app launch local](./media/kubernetes-dashboard-env-variables.png)
202+
One secret, **password**, stores as Key Vault reference in App Configuration was also added into Kubernetes Secrets.
258203
![Quickstart app launch local](./media/kubernetes-dashboard-secrets.png)
259204

260205
## Clean up resources
@@ -266,4 +211,4 @@ We can verify by accessing [Kubernetes Dashboard](https://docs.microsoft.com/azu
266211
In this tutorial, you exported Azure App Configuration data to be used in a Kubernetes deployment with Helm. To learn more about how to use App Configuration, continue to the Azure CLI samples.
267212

268213
> [!div class="nextstepaction"]
269-
> [Managed identity integration](./howto-integrate-azure-managed-service-identity.md)
214+
> [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/appconfig?view=azure-cli-latest)
-96.3 KB
Loading
-28.9 KB
Loading

articles/azure-app-configuration/use-feature-flags-spring-boot.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: In this tutorial, you learn how to implement feature flags in Sprin
44
services: azure-app-configuration
55
documentationcenter: ''
66
author: mrm9084
7-
manager: zhenlwa
7+
manager: zhenlan
88
editor: ''
99

1010
ms.assetid:

0 commit comments

Comments
 (0)