Chapter 20. Configuring for Azure
OpenShift Container Platform can be configured to access an Azure infrastructure, including using Azure disk as persistent storage for application data. After Azure is configured properly, some additional configurations need to be completed on the OpenShift Container Platform hosts.
20.2. The Azure Configuration File
Configuring OpenShift Container Platform for Azure requires the /etc/azure/azure.conf file, on each node host.
If the file does not exist, create it, and add the following:
tenantId: <> 1 subscriptionId: <> 2 aadClientId: <> 3 aadClientSecret: <> 4 aadTenantId: <> 5 resourceGroup: <> 6 location: <> 7
- The AAD tenant ID for the subscription that the cluster is deployed in.
- The Azure subscription ID that the cluster is deployed in.
- The client ID for an AAD application with RBAC access to talk to Azure RM APIs.
- The client secret for an AAD application with RBAC access to talk to Azure RM APIs.
- Ensure this is the same as tenant ID (optional).
- The Azure Resource Group name that Azure VM belongs to.
- The compact style Azure region, for example
20.3. Configuring Masters
Edit or create the master configuration file on all masters (/etc/origin/master/master-config.yaml by default) and update the contents of the
kubernetesMasterConfig: ... apiServerArguments: cloud-provider: - "azure" cloud-config: - "/etc/azure/azure.conf" controllerArguments: cloud-provider: - "azure" cloud-config: - "/etc/azure/azure.conf"
When triggering a containerized installation, only the /etc/origin and /var/lib/origin directories are mounted to the master and node container. Therefore, master-config.yaml should be in /etc/origin/master instead of /etc/.
20.4. Configuring Nodes
Edit or create the node configuration file on all nodes (/etc/origin/node/node-config.yaml by default) and update the contents of the
kubeletArguments: cloud-provider: - "azure" cloud-config: - "/etc/azure/azure.conf"Important
When triggering a containerized installation, only the /etc/origin and /var/lib/origin directories are mounted to the master and node container. Therefore, node-config.yaml should be in /etc/origin/node instead of /etc/.
20.5. Applying Configuration Changes
Start or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:
# systemctl restart atomic-openshift-master # systemctl restart atomic-openshift-node
Switching from not using a cloud provider to using a cloud provider produces an error message. Adding the cloud provider tries to delete the node because the node switches from using the hostname as the
externalID (which would have been the case when no cloud provider was being used) to using the Azure
instance-id (which is what the Azure cloud provider specifies). To resolve this issue:
- Log in to the CLI as a cluster administrator.
Check and backup existing node labels:
$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'
Delete the nodes:
$ oc delete node <node_name>
On each node host, restart the OpenShift Container Platform service.
$ systemctl restart atomic-openshift-node
- Add back any labels on each node that you previously had.