K8S 生态周报| 首个 Docker 官方 Action 发布

855 阅读3分钟

「K8S 生态周报」内容主要包含我所接触到的 K8S 生态相关的每周值得推荐的一些信息。欢迎订阅知乎专栏「k8s生态」

首个 Docker 官方 GitHub Action 发布了

从去年 Docker 将企业服务相关的业务出售给 Mirantis 之后,Docker 将重心放在助力开发者体验上,并为此做了一系列的努力。 包括 1 月份发布了 Docker Desktop v2.2 ,提供了 WSL2 的新架构,以及新的交互式 Desktop Dashboard 等特性。

本周又发布了首个 Docker GitHub Action,简化了 CI/CD 的流程。

这其实也是从另一个角度来推进 DockerHub 的普及(比预期的晚了一些)。DockerHub 上一直都有构建 Docker 镜像的功能,但我个人感觉体验并不够好,从一般意义上来说,它不够灵活;另外我感觉它的调度略慢了一点(虽然现在在优化中了)。

但本次发布的 Docker GitHub Action 可以让用户可以更灵活的通过 GitHub Action 来定义自己的 workflow,并将镜像推送至镜像仓库。这里的镜像仓库并没有和 DockerHub 强制绑定,用户可以自定义镜像仓库的地址。

使用示例如下,完整的项目可参考 docker-github-action 。 需要额外注意的是, 如果你的仓库是公开的,请注意将自己的用户名密码等设置为 secrets ,可参考下方示例,以防泄漏

- name: Build and push Docker images
  uses: docker/build-push-action@v1.0
  with:
    # Username used to log in to a Docker registry. If not set then no login will occur
    username: ${{ secrets.DOCKER_USERNAME }}  
    # Password or personal access token used to log in to a Docker registry. If not set then no login will occur
    password: ${{ secrets.DOCKER_TOKEN }}
    # Docker repository to tag the image with
    repository: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROJECT }}
    # Automatically tags the built image with the git reference as per the readme
    tag_with_ref: true
    # Automatically tags the built image with the git short SHA as per the readme
    tag_with_sha: true
    # Path to run docker build from
    path: .
    # Name of the Dockerfile (Default is 'path/Dockerfile')
    dockerfile: Dockerfile
    # Always attempt to pull a newer version of the image
    always_pull: true
    # Adds labels with git repository information to the built image
    add_git_labels: true
    # Whether to push the image
    push: true

此外 Visual Studio Code Docker extension 1.0 也在本周发布了!据说比之前版本的都好用,使用 vsc 的小伙伴可以尝试下。

etcd v3.4.5 发布

etcd 本周发布的 v3.4.5 包含了一些:

  • #11704 在 server 端的日志中记录了 /health 的检查结果,主要是为了便于在 etcd 挂掉时分析根因;
  • #11694 修复了一个在处理 metrics 可能引起的异常;

其他变更,请参考其 ReleaseNote

Trivy 授权协议变更为 Apache-2.0

Aqua Security 开源的 trivy 是一款镜像漏洞安全扫描程序,对 CI 友好。

可能有些小伙伴不太了解 Aqua Security 这家公司,但大多数人都或多或少用过或者了解过它的一些开源项目:

近期,trivy 的授权协议AGPL v3 修改成了 Apache-2.0,这个事情的意义在于,更多的厂商或者公司可以不用担心 trivy 自身的授权协议,可以在自己的产品或者环境中集成使用 trivy 了!

目前包括 Harbor,Docker 及 Mirantis Docker Enterprise 等正在或者将使用 trivy 作为其默认镜像安全扫描工具。

但需要注意的是,trivy 使用的数据源有些是还是禁止商用来着。

推荐阅读:全面易用的镜像漏洞检测工具:Trivy

上游进展

  • 这是一个对 Kubernetes v1.16 的修复,将一系列主线中的修复都合并到了 v1.16 。这里专门提到它,是因为如果你集群中有很多节点变 NotReady 时,可能会导致 control plane 超载,出现不可用的情况。主要的修正都在 NodeLifecycleController 上,建议想要使用或者正在 v1.16 版本的用户关注下此问题(如果集群规模不大,那受此问题影响的可能性比较小),详情请查看 #88959

项目推荐

Reloader 是一个 Kubernetes controller ,它会 watch ConfigMapSecrets,然后对使用这些资源的 Pod 执行滚动升级。

注意它只兼容 Kubernetes v1.9 及以上。如果有相关需求的小伙伴可以进行尝试。


欢迎订阅我的文章公众号【MoeLove】

TheMoeLove