简体   繁体   English

Kubernetes Statefulset 的准入 webhook

[英]Kubernetes Admission webhook for Statefulset

I created an admission webhook in Kubernetes including resources for deployments and StatefulSet.我在 Kubernetes 中创建了一个 admission webhook,包括部署资源和 StatefulSet。

The mutation webhook works on Deployments but not in StatefulSets.变异 webhook 适用于 Deployment,但不适用于 StatefulSet。

I tried searching in documentations, but the example is only on deployments and ReplicaSets.我尝试在文档中搜索,但该示例仅针对部署和 ReplicaSet。

Are admission controllers supported in StatefulSets in Kubernetes? Kubernetes 中的 StatefulSets 是否支持准入控制器? I am using the 1.16 version.我使用的是 1.16 版本。

In the documentation:在文档中:

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
...
webhooks:
- name: my-webhook.example.com
  rules:
  - operations: ["CREATE", "UPDATE"]
    apiGroups: ["apps"]
    apiVersions: ["v1", "v1beta1"]
    resources: ["deployments", "replicasets"]
    scope: "Namespaced"

Please advise.请指教。

It should be, for example, the PingCap TiDB operator has an option to enable/disable the admission controller for the StatefulSet it manages.例如,PingCap TiDB 运营商应该有一个选项来启用/禁用它管理的 StatefulSet 的准入 controller

I'm not really sure what behavior you are seeing?我不太确定你看到了什么行为? It's not allowing you to create a StatefulSet?它不允许您创建 StatefulSet? If yes, you can start you with '*' values and work your way down.如果是,您可以从“*”值开始,然后一路向下。 For example, allow all namespaces:例如,允许所有命名空间:

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
...
webhooks:
- name: my-webhook.example.com
  rules:
  - operations: ["CREATE", "UPDATE"]
    apiGroups: ["apps"]
    apiVersions: ["v1", "v1beta1"]
    resources: ["deployments", "replicasets", "statefulsets"]
    scope: "*"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM