跳至内容

Kops 滚动更新集群

kops rolling-update cluster

滚动更新集群。

概要

此命令更新 kubernetes 集群以匹配云和 kOps 规范。

要执行滚动更新,您需要先使用命令 kops update cluster --yes 更新云资源。可以通过在节点上放置 kops.k8s.io/needs-update 注释来将节点标记为需要更新。

如果滚动更新未报告集群需要更新,可以使用 --force 标志强制集群更新。滚动更新默认会清空和验证集群。当所有必需的节点都运行且所有具有关键优先级的 Pod 都处于运行状态时,集群被视为已验证。

如果集群处于损坏状态且无法验证,滚动更新将卡住并最终失败;您可以使用 --cloudonly 标志强制更新继续进行,这将跳过验证。

注意:terraform 用户需要在运行 kops rolling-update cluster 之前,从同一目录运行以下所有命令:kops update cluster --target=terraform 然后 terraform plan 然后 terraform apply

kops rolling-update cluster [CLUSTER] [flags]

示例

  # Preview a rolling update.
  kops rolling-update cluster

  # Update the currently selected kOps cluster with defaults.
  # Nodes will be drained and the cluster will be validated between node replacement.
  kops rolling-update cluster --yes

  # Update the k8s-cluster.example.com kOps cluster.
  # Do not fail if the cluster does not validate.
  kops rolling-update cluster k8s-cluster.example.com --yes \
  --fail-on-validate-error="false"

  # Update the k8s-cluster.example.com kOps cluster.
  # Do not validate the cluster.
  # Force the entire cluster to update, even if rolling update
  # reports that the cluster does not need to be updated.
  kops rolling-update cluster k8s-cluster.example.com --yes \
  --cloudonly \
  --force

  # Update only the "nodes-1a" instance group of the k8s-cluster.example.com kOps cluster.
  kops rolling-update cluster k8s-cluster.example.com --yes \
  --instance-group nodes-1a

选项

      --bastion-interval duration         Time to wait between restarting bastions (default 15s)
      --cloudonly                         Perform rolling update without validating cluster status (will cause downtime)
      --control-plane-interval duration   Time to wait between restarting control plane nodes (default 15s)
      --drain-timeout duration            Maximum time to wait for a node to drain (default 15m0s)
      --fail-on-drain-error               Fail if draining a node fails (default true)
      --fail-on-validate-error            Fail if the cluster fails to validate (default true)
      --force                             Force rolling update, even if no changes
  -h, --help                              help for cluster
      --instance-group strings            Instance groups to update (defaults to all if not specified)
      --instance-group-roles strings      Instance group roles to update (control-plane,apiserver,node,bastion)
  -i, --interactive                       Prompt to continue after each instance is updated
      --node-interval duration            Time to wait between restarting worker nodes (default 15s)
      --post-drain-delay duration         Time to wait after draining each node (default 5s)
      --validate-count int32              Number of times that a cluster needs to be validated after single node update (default 2)
      --validation-timeout duration       Maximum time to wait for a cluster to validate (default 15m0s)
  -y, --yes                               Perform rolling update immediately; without --yes rolling-update executes a dry-run

从父命令继承的选项

      --config string   yaml config file (default is $HOME/.kops.yaml)
      --name string     Name of cluster. Overrides KOPS_CLUSTER_NAME environment variable
      --state string    Location of state storage (kops 'config' file). Overrides KOPS_STATE_STORE environment variable
  -v, --v Level         number for the log level verbosity

另请参阅