惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Martin Fowler
Martin Fowler
云风的 BLOG
云风的 BLOG
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
小众软件
小众软件
博客园_首页
博客园 - 聂微东
罗磊的独立博客
Recent Announcements
Recent Announcements
U
Unit 42
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
D
DataBreaches.Net
Last Week in AI
Last Week in AI

hwchiu learning note Blog

Kubernetes 怎麼計算 imageFS | hwchiu learning note Nginx Proxy_Pass 不會重新查詢 DNS | hwchiu learning note Multus 下如何透過 network policy 設定 | hwchiu learning note Linux Bridge MTU | hwchiu learning note Kubevirt 初體驗 | hwchiu learning note [MacOS ]隨手筆記 Sed 與 Rename 的使用 | hwchiu learning note Docusaurus 使用 blog mode 後連結一直反白的問題 | hwchiu learning note gcloud 切換帳號 | hwchiu learning note k8s 內安裝 redis-cluster | hwchiu learning note Helm Chart 中如何根據條件來動態安裝 Template 內的物件 | hwchiu learning note GCS 操作上注意事項 | hwchiu learning note istio 操作記錄 | hwchiu learning note terraform | hwchiu learning note Kubernetes GKE 維運上小筆記 | hwchiu learning note Git 修改 author/committer | hwchiu learning note GCP NAT 相關筆記 | hwchiu learning note gcloud ssh 到 GCP VM | hwchiu learning note CloudSQL 收費注意事項 | hwchiu learning note Loki 安裝上的參數調整以及 Ring 的問題除錯 | hwchiu learning note kustomize + helm | hwchiu learning note 觀測 K8s 內 OOM 事件 | hwchiu learning note GKE 上的 RBAC 筆記 | hwchiu learning note 本地產生 jwt token | hwchiu learning note ArgoCD 安裝筆記 | hwchiu learning note CircleCI Context 的使用 | hwchiu learning note 透過 GCP IAP Gateway 來保護 GKE 內的網站 | hwchiu learning note 閱讀筆記: 「SRE 的工作介绍」 | hwchiu learning note 閱讀筆記: 「DevOps is a failure」 | hwchiu learning note 閱讀筆記: 「面試人生 - 設計一個簡易的分散式 Job Scheduler」 | hwchiu learning note 閱讀筆記: 「Cloudflare 06/21 災後報告」 | hwchiu learning note
閱讀筆記: 「Datree, Kubernetes Configuration 檢查工具」 |...
HungWei ChiuBlogger · 2022-05-20 · via hwchiu learning note Blog

標題: 「Datree, Kubernetes Configuration 檢查工具」 類別: tools 連結: https://opensource.com/article/22/4/kubernetes-policies-config-datree

如同各類程式語言的測試框架, Kubernetes 的部署文件(YAML)實際上也是可以導入 CI 的概念,那到底 YAML 檔案有什麼東西需要檢驗? 最基本的概念大致上可以分成三種

  1. YAML 語法的檢查
  2. Kubernetes YAML 的語意檢查
  3. Kubernetes YAML 的設定規範檢查

除了基本的 YAML 部署外,還要考慮一下團隊是採用何種方式來管理 Kubernetes App,譬如原生 YAML, Helm, Kustomize 等各種不同方法。

(1) 的話其實最基本的方式就是使用 yq 指令,其本身就可以檢查基本的 YAML 語法,如果是 Helm 的使用者也可以透過 Helm template 的方式來嘗試渲染,渲染的過程也會幫忙檢查 YAML 的合法性。 (2) 的話其實也有其他如 kubeval 等類型的工具去幫忙檢驗 YAML 內容是否符合 Kubernees Scheme,這邊要特別注意的還有版本問題,畢竟每次升級都會有很多 API Version 被調整 (3) 的話講究的是規範,譬如要求所有 workload 都必須要描述 CPU/Memory 的Request/Limit,或是要求所有容器都要以 non-root 的身份運行, 這部分有如 kube-score,或是基於 REGO 的 conftest 等工具可以檢測。

而今天分享的這個工具 datree 基本上就是一個人包辦上述三個工具,該工具基本上有兩種模式使用

  1. local 使用,就如同上述所有工具一樣,你可以把所有策略與規則都放到本地環境,搭配 git hook, CI pipeline 等概念去執行
  2. datree 還提供了一個中央管理 Policy 的伺服器,每個運行 datree 的環境都可以與該團隊維護的 server 連動,讓你透過網頁的方式去設定想要驗證的 k8s 版本以及想要檢測的規範有哪些。

基本上這類型的工具愈來愈多,找到一個適合團隊的工具將其整合到 CI 中,讓團隊的 Kubernetes YAML 都能夠符合團隊規範,同時也透過 CI 的流程盡可能提早地找出問題