Search code examples
azurekubernetesazure-akskubernetes-pod

How to assign Azure Pod Identity on local kubernetes(k8s) cluster (while developing)


I am developing an application which uses Pod Identity to connect to Azure Sql Database.

After deploying it on Azure Kubernetes Service (AKS), POD(application) connects to Azure Sql using PodIdentity (Managed Identity).

How can I assign the same identity to POD while running on my local k8s cluster?

My deployment yaml looks like

kind: Deployment
metadata:
  name: xxx
  labels:
    app: xxx
spec:
  selector:
    matchLabels:
     appName: xxx
  replicas: 1
  template:
    metadata:
      labels:
        appName: xxx
        aadpodidbinding: samplepodidentity
    spec:
      containers:
      - name: xxx
        image: xxx
        env:
        - name: xxx
          value: "xxx"
        - name: UpdateDbTraceEndpoint
          value: "xxx"
        ports:
        - containerPort: 80

Update:---------------------------

I tried the the standard walk thru but still it is giving error.

enter image description here

According to me MIC is not working on local K8s cluster. How can I get it working?


Solution

  • You can deploy aad-pod-identity on your local cluster using helm or the YAML Deployment files.

    The main difference is that you can't use some of the az aks commands and instead perform the steps manually like creating the AzureIdentity resource.

    The standard walkthrough doc covers the details.