Kubernetes kubectl create poddisruptionbudget 命令详解

kubectl create poddisruptionbudget

使用指定的name、selector和所需的最小pod数量,创建一个pod disruption budget。

语法

$ poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run]

示例

创建名为my-pdb的pod disruption budget,使用app = rails label #来选择所有po​​d,要求至少1个Pod可用。

kubectl create poddisruptionbudget my-pdb --selector=app=rails --min-available=1

创建名为my-pdb的pod disruption budget,使用app = nginx label #选择所有po​​d,要求至少50%Pod可用。

kubectl create pdb my-pdb --selector=app=nginx --min-available=50%

Flags

Name Shorthand Default Usage
allow-missing-template-keys true If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.
dry-run false If true, only print the object that would be sent, without sending it.
generator poddisruptionbudget/v1beta1/v2 The name of the API generator to use.
max-unavailable The maximum number or percentage of unavailable pods this budget requires.
min-available The minimum number or percentage of available pods this budget requires.
no-headers false When using the default or custom-column output format, don't print headers (default print headers).
output o Output format. One of: json|yaml|wide|name|custom-columns=...|custom-columns-file=...|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=... See custom columns [http://kubernetes.io/docs/user-guide/kubectl-overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [http://kubernetes.io/docs/user-guide/jsonpath].
output-version DEPRECATED: To use a specific API version, fully-qualify the resource, version, and group (for example: 'jobs.v1.batch/myjob').
save-config false If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
schema-cache-dir ~/.kube/schema If non-empty, load/store cached API schemas in this directory, default is '$HOME/.kube/schema'
selector A label selector to use for this budget. Only equality-based selector requirements are supported.
show-all a false When printing, show all resources (default hide terminated pods.)
show-labels false When printing, show all labels as the last column (default hide labels column)
sort-by If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.
template Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
validate true If true, use a schema to validate the input before sending it
K8S中文社区微信公众号

译者

Vincent

业精于勤 荒于嬉;行成于思 毁于随;

发表评论

电子邮件地址不会被公开。

Time limit exceeded. Please complete the captcha once again.