尝试将 django-defectDojo helm chart 和 运行 安装到 StatefulSet 版本错误中

Trying to install django-defectDojo helm chart and running into StatefulSet version error

我正在尝试按照此处给出的 CentOS 机器上的 django-defectDojo 的 helm chart 安装 https://github.com/DefectDojo/django-DefectDojo/blob/master/KUBERNETES.md

但是在 运行 helm install 命令上我 运行 遇到了这个问题 -

Error: validation failed: [unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1", unable to recognize "": no matches for kind "StatefulSet" in version "apps/v1beta2"]

经进一步检查,我认为这与 postgresql 图表有关,但我无法解决该问题。

我的 kubectl 版本是

kubectl version

GitVersion:"v1.17.1", GitCommit:"d224476cd0730baca2b6e357d144171ed74192d6", GitTreeState:"clean", BuildDate:"2020-01-14T21:04:32Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.1", GitCommit:"d224476cd0730baca2b6e357d144171ed74192d6", GitTreeState:"clean", BuildDate:"2020-01-14T20:56:50Z", GoVersion:"go1.13.5", Compiler:"gc", Platform:"linux/amd64"}Client Version: version.Info{Major:"1", Minor:"17",

如有任何帮助,我们将不胜感激。

显然此图表存在问题,如果不进行额外修改,它将不适用于较新版本的 Kubernetes(1.16 及更高版本)。我发现 this issue on django-DefectDojo github page. Here 与您报告的问题相同。

此问题与 Kubernetes APIversion 1.16 中的一些重大变化有关。

Changelog since v1.15.0中您可以阅读以下内容:

The following APIs are no longer served by default: (#70672, @liggitt) * All resources under apps/v1beta1 and apps/v1beta2 - use apps/v1 instead * daemonsets, deployments, replicasets resources under extensions/v1beta1 - use apps/v1 instead * networkpolicies resources under extensions/v1beta1 - use networking.k8s.io/v1 instead * podsecuritypolicies resources under extensions/v1beta1 - use policy/v1beta1 instead

此外,甚至还提供了临时解决方案:

  • Serving these resources can be temporarily re-enabled using the --runtime-config apiserver flag.
  • apps/v1beta1=true
  • apps/v1beta2=true
  • extensions/v1beta1/daemonsets=true,extensions/v1beta1/deployments=true,extensions/v1beta1/replicasets=true,extensions/v1beta1/networkpolicies=true,extensions/v1beta1/podsecuritypolicies=true

  • The ability to serve these resources will be completely removed in v1.18.

由于您的 Kubernetes 版本是 1.17,您仍然可以使用此解决方法。

或者您可以按照建议使用旧的 Kubernetes 版本 here or modify appropriate yaml manifests from django-DefectDojo 自己手动项目,以便它们匹配当前的 Kubernetes API 结构。