跟踪误差
Starting: Bash
==============================================================================
Task : Bash
Description : Run a Bash script on macOS, Linux, or Windows
Version : 3.201.1
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Formatted command: exec bash '/home/vsts/work/1/s/Orchestration/dev/deploy.sh'
========================== Starting Command Output ===========================
/bin/bash /home/vsts/work/_temp/bdf3cbe7-1e0a-4e19-a974-71118a3adb33.sh
error: no context exists with the name: "default"
The connection to the server localhost:8080 was refused - did you specify the right host or port?
The connection to the server localhost:8080 was refused - did you specify the right host or port?
The connection to the server localhost:8080 was refused - did you specify the right host or port?
The connection to the server localhost:8080 was refused - did you specify the right host or port?
##[error]Bash exited with code '1'.
Finishing: Bash当我从azure管道运行任务时
- task: Bash@3
inputs:
filePath: '$(Build.SourcesDirectory)/Orchestration/dev/deploy.sh'这些是deploy.sh的内容
kubectl config use-context default
kubectl apply -f Orchestration/dev/configmap.yaml
kubectl apply -f Orchestration/dev/secrets.yaml
kubectl apply -f Orchestration/dev/deployment.yaml
kubectl apply -f Orchestration/dev/service.yaml我不知道为什么会出现错误,每个azure aks集群都会有一个默认的命名空间,而且我已经有了一个默认的命名空间。

发布于 2022-07-29 09:21:09
Agreed with @Thomas,是您在kubectl config use-context default中传递的名称。这是名称空间的类型,而不是我们需要提供集群名称的类型。
例如,要设置当前上下文:-
$ kubectl config use-context Context_name同样基于这个,
kubeconfig
文件中的上下文元素用于以方便的名称对访问参数进行分组。每个上下文都有三个参数:集群、命名空间和用户。默认情况下,
kubectl命令行工具使用当前上下文中的参数与群集通信。
。
有关更多信息,请参阅此Kubernets 。
和这个类似的所以线程=
https://stackoverflow.com/questions/73161993
复制相似问题