这些是我在AWS EKS 1.17中可用的API
✦ ➜ k api-versions
admissionregistration.k8s.io/v1
admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1
apiextensions.k8s.io/v1beta1
apiregistration.k8s.io/v1
apiregistration.k8s.io/v1beta1
apps/v1
argoproj.io/v1alpha1
authentication.k8s.io/v1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1
authorization.k8s.io/v1beta1
autoscaling/v1
autoscaling/v2beta1
autoscaling/v2beta2
batch/v1
batch/v1beta1
certificates.k8s.io/v1beta1
coordination.k8s.io/v1
coordination.k8s.io/v1beta1
crd.k8s.amazonaws.com/v1alpha1
discovery.k8s.io/v1beta1
events.k8s.io/v1beta1
extensions/v1beta1
metrics.k8s.io/v1beta1
networking.k8s.io/v1
networking.k8s.io/v1beta1
node.k8s.io/v1beta1
policy/v1beta1
rbac.authorization.k8s.io/v1
rbac.authorization.k8s.io/v1beta1
scheduling.k8s.io/v1
scheduling.k8s.io/v1beta1
storage.k8s.io/v1
storage.k8s.io/v1beta1
v1
这是我的policy.yaml文件apiVersion: policy/v1beta1
kind: policy
metadata:
name: default-deny-egress
namespace: edna
spec:
order: 999
egress:
- action: deny
destination:
net: 35.162.205.100
source: {}
当我尝试应用它时,我得到以下信息:error: unable to recognize "app/base/backend/policies/deny-policy.yaml": no matches for kind "policy" in version "v1beta1"
最佳答案
定义网络策略时应使用api/v1beta1
,在这种情况下,该类型也应为NetworkPolicy。我认为这是您应该使用的。policy/v1beta1
版本用于定义poddisruptionbudget。
Policy类型用于定义审核策略和版本audit.k8s.io/v1
,由于在您的输出中不可用,因此无法使用它,因此会出现错误。
Here可能会为您提供帮助的文档。
关于kubernetes - AWS EKS Kubernetes错误:无法识别策略: “policy”版本中的种类 “v1beta1”不匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/63211214/