Forum Discussion
Issue with deploying Docker container to Azure Kubernetes Service
Hi all,
I'm having trouble launching a Docker container to the Azure Kubernetes Service (AKS). I followed the documentation's instructions to generate a Dockerfile, push the image to Azure Container Registry, then construct a deployment file. However, when I use 'kubectl apply -f deployment.yaml' to deploy the container, I receive the following error:
'Error: unable to recognize "deployment.yaml": no matches for kind "Deployment" in version "apps/v1"'
I've double-checked that the API version and kind in my deployment file are correct, and I'm at a loss on what else to try. Is this a common issue, and do you have any advice for troubleshooting?
Thanks in advance for your help!
Best regards,
[Vivek Garg]
1 Reply
Try this:
- Incorrect Kubernetes Context
You might be connected to the wrong cluster or context (e.g., a cluster that doesn’t support Deployments).
kubectl config current-context kubectl get nodes
Make sure you're pointing to your AKS cluster.
- Outdated or Misconfigured Cluster
If your cluster is very old or misconfigured, it might not support apps/v1.
- Check your cluster version:
kubectl version --short
AKS should support apps/v1 if it's running Kubernetes 1.9+.
- Missing Kubernetes Resources
If you're using a custom resource or a stripped-down cluster, the Deployment kind might not be registered.
kubectl api-resources | grep Deployment
If nothing shows up, your cluster doesn’t recognize the Deployment kind.
- YAML Formatting Issues
Even a small typo can cause Kubernetes to misinterpret your manifest.
- Double-check:
apiVersion: apps/v1 kind: Deployment metadata: name: your-deployment-name spec: replicas: 1 selector: matchLabels: app: your-app template: metadata: labels: app: your-app spec: containers: - name: your-container image: yourregistry.azurecr.io/your-image:tag ports: - containerPort: 80
- Namespace or RBAC Issues
If you're deploying to a namespace that doesn’t exist or lacks permissions, the resource might not be recognized.
kubectl get namespaces kubectl config set-context --current --namespace=default