docker - 无法在 minikube 中部署 helm chart
问题描述
我有一个舵图,我在其中部署了 kong 服务。如果我在 EKS (Aws) 中使用远程 kubernetes 集群,则此部署有效。现在我正在部署一个具有相同 K8s 版本的 minikube 集群,但是当我尝试安装 helm chart 时出现下一个错误。
minikube version -> minikube version: v1.19.0
Kubectl version -> Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.12", GitCommit:"7cd5e9086de8ae25d6a1514d0c87bac67ca4a481", GitTreeState:"clean", BuildDate:"2020-11-12T09:18:55Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
helm version: version.BuildInfo{Version:"v3.4.2", GitCommit:"23dd3af5e19a02d4f4baa5b2f242645a1a3af629", GitTreeState:"clean", GoVersion:"go1.14.13"}
错误:无法从发布清单构建 kubernetes 对象:错误验证“”:错误验证数据:未设置 apiVersion
我的 chart.yml 是这样的:
apiversion: v2
name: kong
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
我的 deployment.yaml 是:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-deployment
namespace: {{ .Release.Namespace }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: Recreate
selector:
matchLabels:
app: {{ .Release.Name }}
template:
metadata:
labels:
app: {{ .Release.Name }}
spec:
initContainers:
- name: init-kong
image: "{{ .Values.image.repository }}{{ .Values.global_version }}"
command: [ 'kong', 'migrations', 'bootstrap']
envFrom:
- configMapRef:
name: {{ .Release.Name }}-env
containers:
- image: "{{ .Values.image.repository }}{{ .Values.global_version }}"
envFrom:
- configMapRef:
name: {{ .Release.Name }}-env
livenessProbe:
exec:
command:
- kong
- health
failureThreshold: 3
periodSeconds: 90
timeoutSeconds: 10
name: {{ .Release.Name }}-pod
ports:
- containerPort: 9800
- containerPort: 9801
restartPolicy: Always
volumes:
- name: {{ .Release.Name }}-configmap
configMap:
name: {{ .Release.Name }}-configmap
nodeSelector:
eks.amazonaws.com/nodegroup: "{{ .Values.postgres.WORKER_NODE }}"
我用来安装 helm chart 的命令是(我试图在 chart 目录中执行它,结果相同):
helm install kong kong
解决方案
嗯,错误信息很清楚:
错误:无法从发布清单构建 kubernetes 对象:错误验证“”:错误验证数据:未设置 apiVersion
问题是apiVersion
您的模板中的 是apiversion
,请记住所有 k8s yaml 模板键都应该是驼峰式的:
权利应该是:
apiVersion: v2
name: kong
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
推荐阅读
- facebook-graph-api - 存储要在多个设备上使用的数据的最佳实践?
- go - 将 Tus 可恢复文件上传协议与 Gin-Gonic CORS 问题集成
- c++ - 如何在cmake中控制shell执行的时间
- python - 具有 scipy.stats rvs() 函数的多元随机变量
- python - 如何使用 Django Rest Framework 在单个请求中反序列化多个文件和表单数据?
- javascript - 我的函数应该在 /mixins 还是 /plugins 中?
- ios - 禁用 UITableViewCell 子视图上的交互
- javascript - 如何读取在 JavaScript 中作为 Ajax 响应文本接收的数组
- java - spark-submit 找不到类(当类包含在 jar 中时)
- python-3.x - 如何计算排序后有多少元素改变了它在列表中的位置?