无法在 Minikube 上部署虚拟服务器
Cannot deploy virtual-server on Minikube
我只是在探索并想掌舵我的 k8dash,但由于我已经能够在 AWS EKS 上部署,所以出现了奇怪的错误。
我在我的 Minikube 上 运行 他们 V1.23.2
我的 helm 版本是 v3.6.2
Kubernetes kubectl 版本为 v1.22.3
基本上如果我做 helm 模板,VirtualServer
会是这样的:
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: k8dash
namespace: k8dash
spec:
host: namahost.com
routes:
- action:
pass: RELEASE-NAME
path: /
upstreams:
- name: RELEASE-NAME
port: 80
service: RELEASE-NAME
我得到了这个错误:
Error: unable to build Kubernetes objects from release manifest: unable to recognize "": no matches for kind "VirtualServer" in version "k8s.nginx.org/v1"
很奇怪,在 AWS EKS 上部署这个很好,但在本地出现此错误,我在谷歌搜索时找不到任何线索。跟我的工具版本有关系吗?
您必须安装额外的 CRD,因为 VirtualServer
和 VirtualServerRoute
都不是 oob,而是 nginx 资源。
The CustomResourceDefinition API resource allows you to define custom
resources. Defining a CRD object creates a new custom resource with a
name and schema that you specify. The Kubernetes API serves and
handles the storage of your custom resource. The name of a CRD object
must be a valid DNS subdomain name.
This frees you from writing your own API server to handle the custom
resource, but the generic nature of the implementation means you have
less flexibility than with API server aggregation.
Note: By default, it is required to create custom resource definitions
for VirtualServer, VirtualServerRoute, TransportServer and Policy.
Otherwise, the Ingress Controller pods will not become Ready. If you’d
like to disable that requirement, configure -enable-custom-resources
command-line argument to false and skip this section.
为 VirtualServer 和 VirtualServerRoute、TransportServer 和 Policy 资源创建自定义资源定义。
您可以在 https://github.com/nginxinc/kubernetes-ingress/tree/master/deployments/common/crds 下找到 crds:
$ git clone https://github.com/nginxinc/kubernetes-ingress/
$ cd kubernetes-ingress/deployments
$ git checkout v2.0.3 (or latest, as you wish)
$ kubectl apply -f common/crds/k8s.nginx.org_virtualservers.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_virtualserverroutes.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_transportservers.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_policies.yaml
申请成功后您将可以同时创建VirtualServer
和VirtualServerRoute
我只是在探索并想掌舵我的 k8dash,但由于我已经能够在 AWS EKS 上部署,所以出现了奇怪的错误。
我在我的 Minikube 上 运行 他们 V1.23.2
我的 helm 版本是 v3.6.2
Kubernetes kubectl 版本为 v1.22.3
基本上如果我做 helm 模板,VirtualServer
会是这样的:
apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: k8dash
namespace: k8dash
spec:
host: namahost.com
routes:
- action:
pass: RELEASE-NAME
path: /
upstreams:
- name: RELEASE-NAME
port: 80
service: RELEASE-NAME
我得到了这个错误:
Error: unable to build Kubernetes objects from release manifest: unable to recognize "": no matches for kind "VirtualServer" in version "k8s.nginx.org/v1"
很奇怪,在 AWS EKS 上部署这个很好,但在本地出现此错误,我在谷歌搜索时找不到任何线索。跟我的工具版本有关系吗?
您必须安装额外的 CRD,因为 VirtualServer
和 VirtualServerRoute
都不是 oob,而是 nginx 资源。
The CustomResourceDefinition API resource allows you to define custom resources. Defining a CRD object creates a new custom resource with a name and schema that you specify. The Kubernetes API serves and handles the storage of your custom resource. The name of a CRD object must be a valid DNS subdomain name.
This frees you from writing your own API server to handle the custom resource, but the generic nature of the implementation means you have less flexibility than with API server aggregation.
Note: By default, it is required to create custom resource definitions for VirtualServer, VirtualServerRoute, TransportServer and Policy. Otherwise, the Ingress Controller pods will not become Ready. If you’d like to disable that requirement, configure -enable-custom-resources command-line argument to false and skip this section.
为 VirtualServer 和 VirtualServerRoute、TransportServer 和 Policy 资源创建自定义资源定义。
您可以在 https://github.com/nginxinc/kubernetes-ingress/tree/master/deployments/common/crds 下找到 crds:
$ git clone https://github.com/nginxinc/kubernetes-ingress/
$ cd kubernetes-ingress/deployments
$ git checkout v2.0.3 (or latest, as you wish)
$ kubectl apply -f common/crds/k8s.nginx.org_virtualservers.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_virtualserverroutes.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_transportservers.yaml
$ kubectl apply -f common/crds/k8s.nginx.org_policies.yaml
申请成功后您将可以同时创建VirtualServer
和VirtualServerRoute