Bootstrapping Microservices with Docker, Kubernetes, and Terraform: A project-based guide by Ashley Davis
Author:Ashley Davis [Davis, Ashley]
Language: eng
Format: epub, pdf
Publisher: Manning Publications Co.
Published: 0101-01-01T00:00:00+00:00
6.11.2 Cluster authentication with Azure
We canât create our cluster just yet. If we invoke the apply command at this point, Terraform will ask us to provide values for the variables client_id and client_secret (because we didnât supply default values for these in the code).
These variables provide our Kubernetes cluster with the authentication details for our Azure subscription. To fulfill these variables, we must first create a service principal in Azure. Thatâs like a separate access account that allows our cluster to interact with Azure on our behalf.
It is possible to create the service principal completely in Terraform, and it would be ideal if we could do that. After all, the service principal is only another aspect of our infrastructure, and weâd prefer to have our entire infrastructure created by Terraform.
Unfortunately, at the time of writing, this doesnât work reliably. Although the Azure provider does cater to creating service principals, for some reason, it doesnât deal with the timing of creation properly. It takes time for the service principal to propagate through Azure, and there is no way of delaying the creation of the cluster until the service principal is ready. If we attempt this in Terraform, we will end up creating a cluster before the service principal exists. This results in an error because the creation of the cluster requires the service principal to already be in place.
Due to this problem with the Azure provider (which might be fixed by the time you read this), we canât reliably create the service principal from Terraform. Instead, weâll resort to using the Azure CLI tool for this task. This is actually OK because we only have to create the service principal once, and thereafter, we will simply continue using it. Before you can create the service principal, you must know the ID of your Azure subscription, which you can do with the following command:
az account show
Pick out the value from the id field and use it create your service principal:
az ad sp create-for-rbac --role="Contributor" â¥-scopes="/subscriptions/<subscription-id>"
When you run that command, you should replace <subscription-id> with your own subscription ID. The output from the command will look something like the following:
{ "appId": "a2016492-068c-4f37-a32b-6e6196b65488", "displayName": "flixtube", "name": "http://flixtube", "password": "deb781f5-29e7-42c7-bed8-80781411973a", "tenant": "f88afda7-7b7b-4fb6-a093-6b254e780c4c" }
We have created a service principal for our cluster to authenticate with Azure. Jot down your own values for the fields appId and password (these will be different than mine!). Youâll need these in a moment to input the values for the Terraform variables client_id and client_secret.
Download
Bootstrapping Microservices with Docker, Kubernetes, and Terraform: A project-based guide by Ashley Davis.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
API Testing and Development with Postman by Dave Westerveld(3645)
Learning C# by Developing Games with Unity 2020 by Harrison Ferrone(2641)
Software Architecture for Busy Developers by Stéphane Eyskens(2345)
2021 Beginners Guide to Python Programming Language: A Crash Course to Mastering Python in One Hour by Elmer Gary & Elmer Gary(1884)
Machine Learning for Algorithmic Trading by Stefan Jansen(1632)
Hands-On ROS for Robotics Programming by Bernardo Ronquillo Japón(1576)
Delphi GUI Programming with FireMonkey by Andrea Magni(1457)
Game Development Projects with Unreal Engine by Hammad Fozi & Goncalo Marques & David Pereira & Devin Sherry(1403)
Cloud Native with Kubernetes by Alexander Raul(1376)
Datadog Cloud Monitoring Quick Start Guide by Thomas Kurian Theakanath(1348)
Software Architecture Patterns for Serverless Systems by John Gilbert(1339)
Practical Node-RED Programming by Taiji Hagino(1336)
Automate It with Zapier by Kelly Goss(1321)
Practical System Programming for Rust Developers by Prabhu Eshwarla(1312)
Delphi Programming Projects by William Duarte(1297)
Mastering React Test-Driven Development by Daniel Irvine(1290)
Developing Multi-Platform Apps with Visual Studio Code by Ovais Mehboob Ahmed Khan & Khusro Habib & Chris Dias(1255)
Ghidra Software Reverse Engineering for Beginners by A. P. David(1245)
Learn Spring for Android Application Development by S. M. Mohi Us Sunnat(1236)
