By using kubectl exec -i calicoctl -- /calicoctl create -f - < file.yaml. able to run in cli getting error in azure devops pipeline

3/15/2021

021-03-13T08:42:55.8392238Z ##sectionStarting: kubectl exec 2021-03-13T08:42:55.8405006Z ============================================================================== 2021-03-13T08:42:55.8405352Z Task : Kubectl 2021-03-13T08:42:55.8405912Z Description : Deploy, configure, update a Kubernetes cluster in Azure Container Service by running kubectl commands 2021-03-13T08:42:55.8406301Z Version : 1.181.0 2021-03-13T08:42:55.8406563Z Author : Microsoft Corporation 2021-03-13T08:42:55.8406884Z Help : https://aka.ms/azpipes-kubectl-tsg 2021-03-13T08:42:55.8407232Z ============================================================================== 2021-03-13T08:42:56.3648668Z Downloading: https://storage.googleapis.com/kubernetes-release/release/stable.txt 2021-03-13T08:42:56.5295919Z Downloading: https://storage.googleapis.com/kubernetes-release/release/v1.20.4/bin/linux/amd64/kubectl 2021-03-13T08:42:57.0282085Z Caching tool: kubectl 1.20.4 x64 2021-03-13T08:42:57.0677423Z Prepending PATH environment variable with directory: /opt/hostedtoolcache/kubectl/1.20.4/x64 2021-03-13T08:42:57.1937535Z ============================================================================== 2021-03-13T08:42:57.1938076Z Kubectl Client Version: v1.20.4 2021-03-13T08:42:57.1938494Z Kubectl Server Version: v1.19.6 2021-03-13T08:42:57.1938938Z ============================================================================== 2021-03-13T08:42:57.2065403Z [command]/opt/hostedtoolcache/kubectl/1.20.4/x64/kubectl exec -n kube-system -i calicoctl -- /calicoctl create -f - < global-deny.yaml 2021-03-13T08:42:57.7060782Z Usage: 2021-03-13T08:42:57.7063189Z calicoctl create --filename=<FILENAME> --recursive 2021-03-13T08:42:57.7064917Z --skip-exists --namespace=<NS> 2021-03-13T08:42:57.7067062Z Invalid option: 'calicoctl create -f - < global-deny.yaml'. Use flag '--help' to read about a specific subcommand. 2021-03-13T08:42:57.7120995Z command terminated with exit code 1 2021-03-13T08:42:57.7212396Z ##errorUsage: 2021-03-13T08:42:57.7230325Z ##error calicoctl create --filename=<FILENAME> --recursive 2021-03-13T08:42:57.7231900Z ##error --config=<CONFIG> 2021-03-13T08:42:57.7233388Z ##errorInvalid option: 'calicoctl create -f - < global-deny.yaml'. Use flag '--help' to read about a specific subcommand. 2021-03-13T08:42:57.7234557Z ##errorcommand terminated with exit code 1 2021-03-13T08:42:57.7235473Z commandOutput 2021-03-13T08:42:57.7239235Z ##errorThe process '/opt/hostedtoolcache/kubectl/1.20.4/x64/kubectl' failed with exit code 1 2021-03-13T08:42:57.7286625Z ##sectionFinishing: kubectl exec

Same i'm able to run using cli kubectl exec -n kube-system -i calicoctl -- /calicoctl create -f - < global-deny.yaml

-- shabbir1226
azure-aks
calico
kubectl
kubernetes
pipeline

0 Answers