【发布时间】:2020-03-28 17:01:49
【问题描述】:
我正在努力使用 Helm Charts 和 Gitlab Auto Devops 将应用程序部署到 GKE。我觉得我已经取得了很大的进步,但我已经达到了一些我似乎无法弄清楚的东西。
我现在只有两个阶段,“构建”和“生产”。在“生产”阶段,它在部署到 Kubernetes 后失败,并显示消息 Error from server (NotFound): deployments.extensions "production" not found。我看过类似的 SO 问题,但似乎无法将他们的解决方案与我的环境相匹配。我是整个 kubernetes 的新手,我正在尽我最大的努力将事情拼凑起来,一次解决一个问题……而且出现了很多问题!
这是我的deployment.yml 文件。我使用 kompose 开始使用 Helm 图表。
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -c
kompose.version: 1.19.0 ()
creationTimestamp: null
labels:
io.kompose.service: api
name: api
spec:
replicas: 1
strategy:
type: Recreate
template:
metadata:
namespace: {{ .Release.Namespace }}
annotations:
kompose.cmd: kompose convert -c
kompose.version: 1.19.0 ()
creationTimestamp: null
labels:
io.kompose.service: api
spec:
imagePullSecrets:
- name: gitlab-registry
containers:
- image: git.company.com/company/inventory-api
name: api
env:
- name: RAILS_ENV
value: "production"
ports:
- containerPort: 5000
resources: {}
volumeMounts:
- mountPath: /app
name: api-claim0
restartPolicy: Always
volumes:
- name: api-claim0
persistentVolumeClaim:
claimName: api-claim0
status: {}
【问题讨论】:
-
确保命名空间 mach。您看到的错误可能是因为您尝试访问错误命名空间中的
prod对象。
标签: kubernetes gitlab kubernetes-helm