I use Release pipelines to deploy my apps to AKS. After the build pipeline is finished then trigger release.I saw that all artifacts are already there.The deploy release pipeline is simple. Agency Job, Create Secret Job, and deploy to Kube.netes job.The error happens in the Deployment job
2022-12-04T15:28:24.9668012Z ##[error]error: must specify one of -f and -k [command]/usr/local/bin/kubectl apply -f --namespace dev
The app is based on.Net6 and I use the Manifests folder with one yml. Why apply -f does not find my deployment.yml. I put him here in input Manifests field $(System.DefaultWorkingDirectory)/_Service/Manifests/dev/deployment.yml deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: service-deployment-dev
spec:
selector:
matchLabels:
app: service-dev
template:
metadata:
labels:
app: service-dev
spec:
containers:
- name: service-dev
image: registry.azurecr.io/service-dev
resources:
limits:
memory: "128Mi"
cpu: "200m"
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: service-cluster-dev
namespace: dev
spec:
selector:
app: service-dev
type: ClusterIP
ports:
- name: service-dev
protocol: TCP
port: 80
I can reproduce the same issue when using the Kubectl task and apply command.
The cause of the issue could be that you specified the deployment.yml file in the wrong field of task.
To solve this issue, you need to enable the Use configuration option and set the deployment.yml path.
For example:
Or you can change to use the task: Deploy to Kube.netes to deploy to AKS. In this task, you can directly define the deployment.yml file in the task. And this is required.
For example:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.