Prerequisites
- Create Service principal client ID
- Create Service principal client secret
- Download and install puttygen
- Download and install kubectl package latest version
- Download and install cmder tool
Create Service Principal client ID
Azure Active Directory – App registrations – New application registration
Register a New application form parameters as the next image
Next, you need to copy the Application ID from the DemoClusterApplication and keep it for the AKS Cluster creation.
Create Service principal client secret
Select Settings – Keys, and create a key [MUST copy and keep somewhere safe the key value because after the first saving it is not visible].
Create Azure Container Service (AKS)
After the steps 1, 2 are completed you’re ready to move to the next step which is to create Azure Container Service (AKS)
Create a Resource Group
Provide name, Subscription, RG location and click Create.
Connect to the cluster
Now you are ready to connect to the cluster. Open the cmder tool, and type the commands with the following order :
- az login {Login to Azure}
2. Authenticate the Login by following the instruction on the step 1.
3. Select the Resource Group and the cluster Name.
4.Next, verify the connection to cluster
5. Create the .yaml file (This is the Kubernetes manifest file which include the cluster container images.) 5.1 Create democluster.yaml in C:\Users\username\.kube, copy the following YAML code and type the command kubectl create -f democluster.yaml
apiVersion: apps/v1beta1 kind: Deployment metadata: name: az-demo-cluster-back spec: replicas: 1 template: metadata: labels: app: az-demo-cluster-back spec: containers: - name: az-demo-cluster-back image: redis ports: - containerPort: 6379 name: redis --- apiVersion: v1 kind: Service metadata: name: az-demo-cluster-back spec: ports: - port: 6379 selector: app: az-demo-cluster-back --- apiVersion: apps/v1beta1 kind: Deployment metadata: name: az-demo-cluster-front spec: replicas: 1 template: metadata: labels: app: az-demo-cluster-front spec: containers: - name: az-demo-cluster-front image: microsoft/az-demo-cluster-front:v1 ports: - containerPort: 80 env: - name: REDIS value: "az-demo-cluster-back" --- apiVersion: v1 kind: Service metadata: name: az-demo-cluster-front spec: type: LoadBalancer ports: - port: 80 selector: app: az-demo-cluster-front
6. Last step is to test the app, just type the following commands
7. App is up and running 🙂