首個 Docker 官方 Action 發佈

「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 ,可參考下方示例,以防洩漏

<code>- name: Build and push Docker images 

uses: docker/[email protected]
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/<code>

此外 Visual Studio Code Docker extension 1.0 也在本週發佈了!據說比之前版本的都好用,使用 vsc 的小夥伴可以嘗試下。

etcd v3.4.5 發佈

etcd 本週發佈的 v3.4.5 包含了一些:

  • #11704 在 server 端的日誌中記錄了 /health 的檢查結果,主要是為了便於在 etcd 掛掉時分析根因;
  • #11694 修復了一個在處理 metrics 可能引起的異常;

其他變更,請參考其 ReleaseNote

鏡像漏洞安全掃描程序

Aqua Security 開源的 trivy 是一款鏡像漏洞安全掃描程序,對 CI 友好。

可能有些小夥伴不太瞭解 Aqua Security 這家公司,但大多數人都或多或少用過或者瞭解過它的一些開源項目:

  • kubectl-who-can
  • kube-bench
  • kube-hunter

近期,trivy 的授權協議 href="https://github.com/aquasecurity/trivy/pull/434">從 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 ConfigMap/Secrets,然後對應的支持滾動升級。

注意它只兼容 Kubernetes v1.9 及以上。如果有相關需求的小夥伴可以進行嘗試。


歡迎訂閱我的文章公眾號【MoeLove】


分享到:


相關文章: