Asi*_*mez 6 jenkins kubernetes kubectl
我正在尝试使用Jenkins在Kubernetes中部署下一个frontend-deployment.yaml,但是出现下一个错误:
[frontend] Running shell script
+ kubectl apply -f IKonnekt/frontend-deployment.yaml
error: unable to recognize "IKonnekt/frontend-deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"
Run Code Online (Sandbox Code Playgroud)
如果我kubectl apply -f IKonnekt/frontend-deployment.yaml从Kubernetes集群中的机器上运行,则可以正常工作。
Kubernetes Client Version: 1.12.1
Kubernetes Server Version: 1.11.0
Run Code Online (Sandbox Code Playgroud)
这是我的frontend-deployment.yaml:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ikonnekt-frontend-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: ikonnekt-frontend
spec:
containers:
- name: ikonnekt-frontend
image: ikonnektfrontend
imagePullPolicy: Always
env:
- name: REACT_APP_API
value: "http://IP:Port"
- name: REACT_APP_AUTH_ENDPOINT
value: "http://IP:Port/auth"
ports:
- containerPort: 80
imagePullSecrets:
- name: regcred
Run Code Online (Sandbox Code Playgroud)
Asi*_*mez -1
我的问题是因为在 Jenkinsfile 中我使用的是 Kubernetes 仪表板 URL 而不是 Kubernetes API URL,因此 Jenkins 的 kubectl 无法识别 kubernetes 服务器。
最后,使用 API URL 并更新 apiVersion 它对我有用。
| 归档时间: |
|
| 查看次数: |
9508 次 |
| 最近记录: |