|
| 1 | +--- |
| 2 | +title: Configure the Dapr extension for your Azure Kubernetes Service (AKS) and Arc-enabled Kubernetes project |
| 3 | +description: Learn how to configure the Dapr extension specifically for your Azure Kubernetes Service (AKS) and Arc-enabled Kubernetes project |
| 4 | +author: hhunter-ms |
| 5 | +ms.author: hannahhunter |
| 6 | +ms.service: container-service |
| 7 | +ms.topic: article |
| 8 | +ms.date: 01/09/2023 |
| 9 | +--- |
| 10 | + |
| 11 | +# Configure the Dapr extension for your Azure Kubernetes Service (AKS) and Arc-enabled Kubernetes project |
| 12 | + |
| 13 | +Once you've [created the Dapr extension](./dapr.md), you can configure the [Dapr](https://dapr.io/) extension to work best for you and your project using various configuration options, like: |
| 14 | + |
| 15 | +- Limiting which of your nodes use the Dapr extension |
| 16 | +- Setting automatic CRD updates |
| 17 | +- Configuring the Dapr release namespace |
| 18 | + |
| 19 | +The extension enables you to set Dapr configuration options by using the `--configuration-settings` parameter. For example, to provision Dapr with high availability (HA) enabled, set the `global.ha.enabled` parameter to `true`: |
| 20 | + |
| 21 | +```azurecli |
| 22 | +az k8s-extension create --cluster-type managedClusters \ |
| 23 | +--cluster-name myAKSCluster \ |
| 24 | +--resource-group myResourceGroup \ |
| 25 | +--name dapr \ |
| 26 | +--extension-type Microsoft.Dapr \ |
| 27 | +--auto-upgrade-minor-version true \ |
| 28 | +--configuration-settings "global.ha.enabled=true" \ |
| 29 | +--configuration-settings "dapr_operator.replicaCount=2" |
| 30 | +``` |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> If configuration settings are sensitive and need to be protected, for example cert related information, pass the `--configuration-protected-settings` parameter and the value will be protected from being read. |
| 34 | +
|
| 35 | +If no configuration-settings are passed, the Dapr configuration defaults to: |
| 36 | + |
| 37 | +```yaml |
| 38 | + ha: |
| 39 | + enabled: true |
| 40 | + replicaCount: 3 |
| 41 | + disruption: |
| 42 | + minimumAvailable: "" |
| 43 | + maximumUnavailable: "25%" |
| 44 | + prometheus: |
| 45 | + enabled: true |
| 46 | + port: 9090 |
| 47 | + mtls: |
| 48 | + enabled: true |
| 49 | + workloadCertTTL: 24h |
| 50 | + allowedClockSkew: 15m |
| 51 | +``` |
| 52 | +
|
| 53 | +For a list of available options, see [Dapr configuration][dapr-configuration-options]. |
| 54 | +
|
| 55 | +## Limiting the extension to certain nodes |
| 56 | +
|
| 57 | +In some configurations, you may only want to run Dapr on certain nodes. You can limit the extension by passing a `nodeSelector` in the extension configuration. If the desired `nodeSelector` contains `.`, you must escape them from the shell and the extension. For example, the following configuration will install Dapr to only nodes with `topology.kubernetes.io/zone: "us-east-1c"`: |
| 58 | + |
| 59 | +```azurecli |
| 60 | +az k8s-extension create --cluster-type managedClusters \ |
| 61 | +--cluster-name myAKSCluster \ |
| 62 | +--resource-group myResourceGroup \ |
| 63 | +--name dapr \ |
| 64 | +--extension-type Microsoft.Dapr \ |
| 65 | +--auto-upgrade-minor-version true \ |
| 66 | +--configuration-settings "global.ha.enabled=true" \ |
| 67 | +--configuration-settings "dapr_operator.replicaCount=2" \ |
| 68 | +--configuration-settings "global.nodeSelector.kubernetes\.io/zone: us-east-1c" |
| 69 | +``` |
| 70 | + |
| 71 | +For managing OS and architecture, use the [supported versions](https://github.com/dapr/dapr/blob/b8ae13bf3f0a84c25051fcdacbfd8ac8e32695df/docker/docker.mk#L50) of the `global.daprControlPlaneOs` and `global.daprControlPlaneArch` configuration: |
| 72 | + |
| 73 | +```azurecli |
| 74 | +az k8s-extension create --cluster-type managedClusters \ |
| 75 | +--cluster-name myAKSCluster \ |
| 76 | +--resource-group myResourceGroup \ |
| 77 | +--name dapr \ |
| 78 | +--extension-type Microsoft.Dapr \ |
| 79 | +--auto-upgrade-minor-version true \ |
| 80 | +--configuration-settings "global.ha.enabled=true" \ |
| 81 | +--configuration-settings "dapr_operator.replicaCount=2" \ |
| 82 | +--configuration-settings "global.daprControlPlaneOs=linux” \ |
| 83 | +--configuration-settings "global.daprControlPlaneArch=amd64” |
| 84 | +``` |
| 85 | +## Configure the Dapr release namespace |
| 86 | + |
| 87 | +You can configure the release namespace. The Dapr extension gets installed in the `dapr-system` namespace by default. To override it, use `--release-namespace`. Include the cluster `--scope` to redefine the namespace. |
| 88 | + |
| 89 | +```azurecli |
| 90 | +az k8s-extension create \ |
| 91 | +--cluster-type managedClusters \ |
| 92 | +--cluster-name dapr-aks \ |
| 93 | +--resource-group dapr-rg \ |
| 94 | +--name my-dapr-ext \ |
| 95 | +--extension-type microsoft.dapr \ |
| 96 | +--release-train stable \ |
| 97 | +--auto-upgrade false \ |
| 98 | +--version 1.9.2 \ |
| 99 | +--scope cluster \ |
| 100 | +--release-namespace dapr-custom |
| 101 | +``` |
| 102 | + |
| 103 | +[Learn how to configure the Dapr release namespace if you already have Dapr installed](./dapr-migration.md). |
| 104 | + |
| 105 | +## Show current configuration settings |
| 106 | + |
| 107 | +Use the `az k8s-extension show` command to show the current Dapr configuration settings: |
| 108 | + |
| 109 | +```azurecli |
| 110 | +az k8s-extension show --cluster-type managedClusters \ |
| 111 | +--cluster-name myAKSCluster \ |
| 112 | +--resource-group myResourceGroup \ |
| 113 | +--name dapr |
| 114 | +``` |
| 115 | + |
| 116 | +## Update configuration settings |
| 117 | + |
| 118 | +> [!IMPORTANT] |
| 119 | +> Some configuration options cannot be modified post-creation. Adjustments to these options require deletion and recreation of the extension, applicable to the following settings: |
| 120 | +> * `global.ha.*` |
| 121 | +> * `dapr_placement.*` |
| 122 | +> |
| 123 | +> HA is enabled enabled by default. Disabling it requires deletion and recreation of the extension. |
| 124 | + |
| 125 | +To update your Dapr configuration settings, recreate the extension with the desired state. For example, assume we've previously created and installed the extension using the following configuration: |
| 126 | + |
| 127 | +```azurecli-interactive |
| 128 | +az k8s-extension create --cluster-type managedClusters \ |
| 129 | +--cluster-name myAKSCluster \ |
| 130 | +--resource-group myResourceGroup \ |
| 131 | +--name dapr \ |
| 132 | +--extension-type Microsoft.Dapr \ |
| 133 | +--auto-upgrade-minor-version true \ |
| 134 | +--configuration-settings "global.ha.enabled=true" \ |
| 135 | +--configuration-settings "dapr_operator.replicaCount=2" |
| 136 | +``` |
| 137 | + |
| 138 | +To update the `dapr_operator.replicaCount` from two to three, use the following command: |
| 139 | + |
| 140 | +```azurecli-interactive |
| 141 | +az k8s-extension create --cluster-type managedClusters \ |
| 142 | +--cluster-name myAKSCluster \ |
| 143 | +--resource-group myResourceGroup \ |
| 144 | +--name dapr \ |
| 145 | +--extension-type Microsoft.Dapr \ |
| 146 | +--auto-upgrade-minor-version true \ |
| 147 | +--configuration-settings "global.ha.enabled=true" \ |
| 148 | +--configuration-settings "dapr_operator.replicaCount=3" |
| 149 | +``` |
| 150 | + |
| 151 | +## Set the outbound proxy for Dapr extension for Azure Arc on-premises |
| 152 | + |
| 153 | +If you want to use an outbound proxy with the Dapr extension for AKS, you can do so by: |
| 154 | + |
| 155 | +1. Setting the proxy environment variables using the [`dapr.io/env` annotations](https://docs.dapr.io/reference/arguments-annotations-overview/): |
| 156 | + - `HTTP_PROXY` |
| 157 | + - `HTTPS_PROXY` |
| 158 | + - `NO_PROXY` |
| 159 | +1. [Installing the proxy certificate in the sidecar](https://docs.dapr.io/operations/configuration/install-certificates/). |
| 160 | + |
| 161 | +## Disable automatic CRD updates |
| 162 | + |
| 163 | +With Dapr version 1.9.2, CRDs are automatically upgraded when the extension upgrades. To disable this setting, you can set `hooks.applyCrds` to `false`. |
| 164 | + |
| 165 | +```azurecli |
| 166 | +az k8s-extension upgrade --cluster-type managedClusters \ |
| 167 | +--cluster-name myAKSCluster \ |
| 168 | +--resource-group myResourceGroup \ |
| 169 | +--name dapr \ |
| 170 | +--extension-type Microsoft.Dapr \ |
| 171 | +--auto-upgrade-minor-version true \ |
| 172 | +--configuration-settings "global.ha.enabled=true" \ |
| 173 | +--configuration-settings "dapr_operator.replicaCount=2" \ |
| 174 | +--configuration-settings "global.daprControlPlaneOs=linux” \ |
| 175 | +--configuration-settings "global.daprControlPlaneArch=amd64” \ |
| 176 | +--configuration-settings "hooks.applyCrds=false" |
| 177 | +``` |
| 178 | + |
| 179 | +> [!NOTE] |
| 180 | +> CRDs are only applied in case of upgrades and are skipped during downgrades. |
| 181 | + |
| 182 | + |
| 183 | +## Meet network requirements |
| 184 | + |
| 185 | +The Dapr extension for AKS and Arc for Kubernetes requires outbound URLs on `https://:443` to function. In addition to the `https://mcr.microsoft.com/daprio` URL for pulling Dapr artifacts, verify you've included the [outbound URLs required for AKS or Arc for Kubernetes](../azure-arc/kubernetes/quickstart-connect-cluster.md#meet-network-requirements). |
| 186 | + |
| 187 | +## Next Steps |
| 188 | + |
| 189 | +Once you have successfully provisioned Dapr in your AKS cluster, try deploying a [sample application][sample-application]. |
| 190 | + |
| 191 | +<!-- LINKS INTERNAL --> |
| 192 | +[deploy-cluster]: ./tutorial-kubernetes-deploy-cluster.md |
| 193 | +[az-feature-register]: /cli/azure/feature#az-feature-register |
| 194 | +[az-feature-list]: /cli/azure/feature#az-feature-list |
| 195 | +[az-provider-register]: /cli/azure/provider#az-provider-register |
| 196 | +[sample-application]: ./quickstart-dapr.md |
| 197 | +[k8s-version-support-policy]: ./supported-kubernetes-versions.md?tabs=azure-cli#kubernetes-version-support-policy |
| 198 | +[arc-k8s-cluster]: ../azure-arc/kubernetes/quickstart-connect-cluster.md |
| 199 | +[update-extension]: ./cluster-extensions.md#update-extension-instance |
| 200 | +[install-cli]: /cli/azure/install-azure-cli |
| 201 | +[dapr-migration]: ./dapr-migration.md |
| 202 | +[dapr-settings]: ./dapr-settings.md |
| 203 | + |
| 204 | +<!-- LINKS EXTERNAL --> |
| 205 | +[kubernetes-production]: https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-production |
| 206 | +[building-blocks-concepts]: https://docs.dapr.io/developing-applications/building-blocks/ |
| 207 | +[dapr-configuration-options]: https://github.com/dapr/dapr/blob/master/charts/dapr/README.md#configuration |
| 208 | +[sample-application]: https://github.com/dapr/quickstarts/tree/master/hello-kubernetes#step-2---create-and-configure-a-state-store |
| 209 | +[dapr-security]: https://docs.dapr.io/concepts/security-concept/ |
| 210 | +[dapr-deployment-annotations]: https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-overview/#adding-dapr-to-a-kubernetes-deployment |
| 211 | +[dapr-oss-support]: https://docs.dapr.io/operations/support/support-release-policy/ |
| 212 | +[dapr-supported-version]: https://docs.dapr.io/operations/support/support-release-policy/#supported-versions |
| 213 | +[dapr-troubleshooting]: https://docs.dapr.io/operations/troubleshooting/common_issues/ |
| 214 | +[supported-cloud-regions]: https://azure.microsoft.com/global-infrastructure/services/?products=azure-arc |
0 commit comments