<p>I am new to Azure Kubernetes Service. I have created an Azure Kubernetes cluster and tried to deploy some workload in it. The .yaml file as follows</p>
<pre><code>- apiVersion: v1
  kind: Namespace
  metadata:
    name: azure-vote
  spec:
    finalizers:
      - kubernetes
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: azure-vote-back
    namespace: azure-vote
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: azure-vote-back
    template:
      metadata:
        labels:
          app: azure-vote-back
      spec:
        nodeSelector:
          beta.kubernetes.io/os: linux
        containers:
          - name: azure-vote-back
            image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
            env:
              - name: ALLOW_EMPTY_PASSWORD
                value: 'yes'
            resources:
              requests:
                cpu: 100m
                memory: 128Mi
              limits:
                cpu: 250m
                memory: 256Mi
            ports:
              - containerPort: 6379
                name: redis
- apiVersion: v1
  kind: Service
  metadata:
    name: azure-vote-back
    namespace: azure-vote
  spec:
    ports:
      - port: 6379
    selector:
      app: azure-vote-back
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: azure-vote-front
    namespace: azure-vote
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: azure-vote-front
    template:
      metadata:
        labels:
          app: azure-vote-front
      spec:
        nodeSelector:
          beta.kubernetes.io/os: linux
        containers:
          - name: azure-vote-front
            image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
            resources:
              requests:
                cpu: 100m
                memory: 128Mi
              limits:
                cpu: 250m
                memory: 256Mi
            ports:
              - containerPort: 80
            env:
              - name: REDIS
                value: azure-vote-back
- apiVersion: v1
  kind: Service
  metadata:
    name: azure-vote-front
    namespace: azure-vote
  spec:
    type: LoadBalancer
    ports:
      - port: 80
    selector:
      app: azure-vote-front
</code></pre>
<p>When I deploy this .yaml via Azure CLI it gives me a validation error but doesn't indicate where is it? When I run the kubectl apply -f ./filename.yaml --validate=false it gives <strong>&quot;cannot unmarshal array into Go value of type unstructured.detector&quot;</strong> error. However, when I run the same yaml in Azure portal UI it runs without any error. Appreciate if someone can mention the reason for this and how to fix this.</p>

Rama
<p>I tried to run the code you have provided in the <em><strong>Portal</strong></em> as well as <em><strong>Azure CLI</strong></em>. It successfully got created in <em>Portal UI</em> by adding the <code>YAML code</code> but using <em>Azure CLI</em> I received the same error as you :</p>
<p><a href="https://i.stack.imgur.com/bUZuG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bUZuG.png" alt="enter image description here" /></a></p>
<p>After doing some modifications in your <code>YAML file</code> and validating it , I ran the same command again and it successfully got deployed in <em><strong>Azure CLI</strong></em>:</p>
<p><strong>YAML File:</strong></p>
<pre><code>apiVersion: v1
kind: Namespace
metadata:
  name: azure-vote
spec:
  finalizers:
    - kubernetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: azure-vote-back
  namespace: azure-vote
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azure-vote-back
  template:
    metadata:
      labels:
        app: azure-vote-back
    spec:
      nodeSelector:
        &quot;kubernetes.io/os&quot;: linux
      containers:
      - name: azure-vote-back
        image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
        env:
        - name: ALLOW_EMPTY_PASSWORD
          value: &quot;yes&quot;
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
        ports:
        - containerPort: 6379
          name: redis
---
apiVersion: v1
kind: Service
metadata:
  name: azure-vote-back
spec:
  ports:
  - port: 6379
  selector:
    app: azure-vote-back
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: azure-vote-front
  namespace: azure-vote
spec:
  replicas: 1
  selector:
    matchLabels:
      app: azure-vote-front
  template:
    metadata:
      labels:
        app: azure-vote-front
    spec:
      nodeSelector:
        &quot;kubernetes.io/os&quot;: linux
      containers:
      - name: azure-vote-front
        image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 250m
            memory: 256Mi
        ports:
        - containerPort: 80
        env:
        - name: REDIS
          value: &quot;azure-vote-back&quot;
---
apiVersion: v1
kind: Service
metadata:
  name: azure-vote-front
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: azure-vote-front
</code></pre>
<p><strong>Output:</strong></p>
<p><a href="https://i.stack.imgur.com/Br7Cy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Br7Cy.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/0nfuk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0nfuk.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/dxeod.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dxeod.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/UnS4m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UnS4m.png" alt="enter image description here" /></a></p>
