Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无状态应用滚动更新 | 袁昊的学习笔记 #44

Open
howieyuen opened this issue Jan 6, 2021 · 0 comments
Open

无状态应用滚动更新 | 袁昊的学习笔记 #44

howieyuen opened this issue Jan 6, 2021 · 0 comments

Comments

@howieyuen
Copy link
Owner

https://howieyuen.github.io/docs/kubernetes/kube-controller-manager/k8s-apps-rolling-update/#23-%E6%BB%9A%E5%8A%A8%E6%9B%B4%E6%96%B0%E7%A4%BA%E4%BE%8B

  1. 概念 # 滚动更新,通常出现在软件或者是系统中。滚动更新与传统更新的不同之处在于: 滚动更新不但提供了更新服务,而且通常还提供了滚动进度查询,滚动历史记录, 以及最重要的回滚等能力。通俗地说,就是具有系统或是软件的主动降级的能力。
  2. Deployment 滚动更新 # Deployment 更新方式有 2 种:
    RollingUpdate Recreate 其中,滚动更新是最常见的,阅读代码 pkg/controller/deployment/deployment_controller.go:648, 可以看到 2 种方式分别对应的业务逻辑:
    func (dc *DeploymentController) syncDeployment(key string) error { ... switch d.Spec.Strategy.Type { case apps.RecreateDeploymentStrategyType: return dc.rolloutRecreate(d, rsList, podMap) case apps.RollingUpdateDeploymentStrategyType: return dc.rolloutRolling(d, rsList) } ... } 根据 d.Spec.Strategy.Type,若更新策略为 RollingUpdate, 则执行 dc.rolloutRecreate() 方法,具体逻辑如下:
    func (dc *DeploymentController) rolloutRolling(d *apps.Deployment, rsList []*apps.ReplicaSet) error { // 1、获取所有的 rs,若没有 newRS 则创建 newRS, oldRSs, err := dc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant