Kubernetes一致性认证

Certified Kubernetes是CNCF基金会在2018年推出的Kubernetes一致性认证计划。它由CNCF基金会提供的一套诊断测试工具(Sonobuoy)并运行在Kubernetes中。各云厂商如果需要将自己产品纳入到Certified Kubernetes当中,就需要按照操作指导进行自身测试,并将测试结果上传给CNCF社区,当报告审核通过,交付一定的费用(CNCF Members免费)后,就会得到CNCF基金会给企业颁发一个Certified Kubernetes的认证。也就是说得到认证后企业就能在自己的产品宣传上使用CNCF基金会的Certified Kubernetes商标和在产品中使用带Kubernetes字样的名称。Certified Kubernetes Logo大概长这个样子。

Sonobuoy is a diagnostic tool that makes it easier to understand the state of a Kubernetes cluster by running a set of plugins (including Kubernetes conformance tests) in an accessible and non-destructive manner. It is a customizable, extendable, and cluster-agnostic way to generate clear, informative reports about your cluster.

Certified Kubernetes好处

  • 一致性

只要获得了一致性认证,用户在对任何Kubernetes厂商发行版进行安装或交互时,得到的和原生Kuberentes功能几乎一致的体验

  • 及时更新

为了保持认证,CNCF基金会要求厂商需要每年或更频繁地提供对最版本的Kubernetes支持。通常情况下来说,厂商提交的产品适配的版本,为官方最新的次要发型版本(x.y)以及最近的两个发行版(x.y-1 和 x.y-2)

例子。在Kubernetes v1.23发布后,新的合格产品最初可以针对Kubernetes v1.23、v1.22或v1.21进行自我认证,但不能针对v1.20再进行测试。

了解Kubernetes的同学都知道,K8S几乎每年会以3-4个大版本进行迭代,这样就等于让各大厂商必须跟这个K8S的迭代进行适配。也侧面上加强了社区对于各大厂商的控制
  • 可确认性

任何终端用户都可以通过运行用于认证的相同的开源一致性应用程序(Sonobuoy)来确认他们的发行版或平台仍然符合要求,以免用户被厂商锁定。

Sonobuoy

Sonobuoy 是一个诊断工具,通过它我们可以访问且以非破坏性的方式运行一组插件(其中包括Kubernetes一致性认证的测试)使我们更轻松地了解 Kubernetes 集群的状态。同时Sonobuoy 也是一种可定制、可扩展和黑盒的方式生成有关Kubernetes集群的相关报告工具。

我们可以用Sonobuoy来对Kubernetes内的资源做如下用例测试:

  • 集成的端到端 (e2e) 一致性测试
  • 工作负载调试
  • 扩展插件来采集自定义数据

环境准备

在使用Sonobuoy之前我们需要准备好如下环境:

  • 一个可以正常访问的Kubernetes集群
  • 拥有被测试Kubernetes集群的ADMIN权限,以及它的kubeconfig文件
  • kubectl命令(某些告警场景会用,Certified Kubernetes不需要)

安装

在下述链接中下载最新版本的Sonobuoy二进制文件,将它解压后,并把可执行文件sonobuoy路径添加到系统的PATH环境变量下即可。

https://github.com/vmware-tanzu/sonobuoy/releases
例如:
tar -xzvf sonobuoy_0.56.4_linux_amd64 .tar.gz
$ mv sonobuoy /usr/bin/

镜像准备

1、先查看一下需要哪些镜像把镜像都下载下来传到k8s所在集群服务器上面
[root@master-1 ~]# sonobuoy images pull
gcr.io/authenticated-image-pulling/alpine:3.7
gcr.io/authenticated-image-pulling/windows-nanoserver:v1
gcr.io/k8s-authenticated-test/agnhost:2.6
invalid.com/invalid/alpine:3.1
k8s.gcr.io/build-image/debian-iptables:bullseye-v1.1.0
k8s.gcr.io/conformance:v1.23.1
k8s.gcr.io/e2e-test-images/agnhost:2.33
k8s.gcr.io/e2e-test-images/apparmor-loader:1.4
k8s.gcr.io/e2e-test-images/busybox:1.29-2
k8s.gcr.io/e2e-test-images/cuda-vector-add:1.0
k8s.gcr.io/e2e-test-images/cuda-vector-add:2.2
k8s.gcr.io/e2e-test-images/echoserver:2.4
k8s.gcr.io/e2e-test-images/glusterdynamic-provisioner:v1.3
k8s.gcr.io/e2e-test-images/httpd:2.4.38-2
k8s.gcr.io/e2e-test-images/httpd:2.4.39-2
k8s.gcr.io/e2e-test-images/ipc-utils:1.3
k8s.gcr.io/e2e-test-images/jessie-dnsutils:1.5
k8s.gcr.io/e2e-test-images/kitten:1.5
k8s.gcr.io/e2e-test-images/metadata-concealment:1.6
k8s.gcr.io/e2e-test-images/nautilus:1.5
k8s.gcr.io/e2e-test-images/nginx:1.14-2
k8s.gcr.io/e2e-test-images/nginx:1.15-2
k8s.gcr.io/e2e-test-images/node-perf/npb-ep:1.2
k8s.gcr.io/e2e-test-images/node-perf/npb-is:1.2
k8s.gcr.io/e2e-test-images/node-perf/tf-wide-deep:1.1
k8s.gcr.io/e2e-test-images/nonewprivs:1.3
k8s.gcr.io/e2e-test-images/nonroot:1.2
k8s.gcr.io/e2e-test-images/perl:5.26
k8s.gcr.io/e2e-test-images/redis:5.0.5-1
k8s.gcr.io/e2e-test-images/regression-issue-74839:1.2
k8s.gcr.io/e2e-test-images/resource-consumer:1.10
k8s.gcr.io/e2e-test-images/sample-apiserver:1.17.5
k8s.gcr.io/e2e-test-images/volume/gluster:1.3
k8s.gcr.io/e2e-test-images/volume/iscsi:2.3
k8s.gcr.io/e2e-test-images/volume/nfs:1.3
k8s.gcr.io/e2e-test-images/volume/rbd:1.0.4
k8s.gcr.io/etcd:3.5.1-0
k8s.gcr.io/pause:3.6
k8s.gcr.io/prometheus-dummy-exporter:v0.1.0
k8s.gcr.io/prometheus-to-sd:v0.5.0
k8s.gcr.io/sd-dummy-exporter:v0.2.0
k8s.gcr.io/sig-storage/nfs-provisioner:v2.2.2
mcr.microsoft.com/windows:1809
sonobuoy/sonobuoy:v0.56.4
sonobuoy/systemd-logs:v0.4

运行测试

标准的一致性测试集目前是由 kubernetes e2e套件中的 [Conformance] 标签定义的。所以我们需要使用如下命令进行部署。

$ sonobuoy run --mode=certified-conformance --image-pull-policy IfNotPresent --wait //使用本地镜像
INFO[0000] created object                                name=sonobuoy namespace= resource=namespaces
INFO[0000] created object                                name=sonobuoy-serviceaccount namespace=sonobuoy resource=serviceaccounts
INFO[0001] created object                                name=sonobuoy-serviceaccount-sonobuoy namespace= resource=clusterrolebindings
INFO[0001] created object                                name=sonobuoy-serviceaccount-sonobuoy namespace= resource=clusterroles
INFO[0001] created object                                name=sonobuoy-config-cm namespace=sonobuoy resource=configmaps
INFO[0001] created object                                name=sonobuoy-plugins-cm namespace=sonobuoy resource=configmaps
INFO[0001] created object                                name=sonobuoy namespace=sonobuoy resource=pods
INFO[0001] created object                                name=plugin-e2e-cm namespace=sonobuoy resource=configmaps
INFO[0001] created object                                name=sonobuoy-aggregator namespace=sonobuoy resource=services

当sonobuoy容器正常运后,它就会开始创建e2e容器和systemd-log容器开始进行相关的测试和日志收集。

$ kubectl get pod -n sonobuoy
NAME                                                      READY   STATUS    RESTARTS   AGE   IP               NODE              NOMINATED NODE   READINESS GATES
sonobuoy                                                  1/1     Running   0          31s   192.169.15.126   k8s-master3-123   <none>           <none>
sonobuoy-e2e-job-23d08735503942f5                         2/2     Running   0          27s   192.169.15.86    k8s-master3-123   <none>           <none>
sonobuoy-systemd-logs-daemon-set-c7fe30c923a848d5-c7wvz   2/2     Running   0          27s   172.16.23.123    k8s-master3-123   <none>           <none>
sonobuoy-systemd-logs-daemon-set-c7fe30c923a848d5-d28gr   2/2     Running   0          27s   172.16.23.122    k8s-master2-122   <none>           <none>
sonobuoy-systemd-logs-daemon-set-c7fe30c923a848d5-q25t8   2/2     Running   0          27s   172.16.23.124    k8s-node1-124     <none>           <none>
sonobuoy-systemd-logs-daemon-set-c7fe30c923a848d5-wkd4f   2/2     Running   0          27s   172.16.23.125    k8s-node2-125     <none>           <none>
sonobuoy-systemd-logs-daemon-set-c7fe30c923a848d5-z829h   2/2     Running   0          27s   172.16.23.121    k8s-master1-121   <none>           <none>

在测试的进行过程中,我们可以使用sonobuoy status命令进行查看当前任务的执行状态,可以用sonobuoy logs来查看用例的执行日志。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-FrIge1Y2-1650183156903)(C:\Users\SQ\AppData\Roaming\Typora\typora-user-images\image-20220417151438001.png)]

提示:certified-conformance测试通常会跑2个小时

当我们用sonobuoy status发现状态都为completed时,就代表一致性测试运行完成。

提取结果

运行命令sonobuoy retrieve就会把当前跑完的测试结果以tar包的方式保存在当前目录,对它进行解压就得到了类似如下目录结构的文件。

$ tree -L 2
.
├── 202108180508_sonobuoy_ff7aa0c1-34cb-4375-a09e-153235a96d34.tar.gz
├── hosts
│   ├── k8s-master1-121
│   ├── k8s-master2-122
│   ├── k8s-master3-123
│   ├── k8s-node1-124
│   └── k8s-node2-125
├── meta
│   ├── config.json
│   ├── info.json
│   ├── query-time.json
│   └── run.log
├── plugins
│   ├── e2e
│   └── systemd-logs
├── podlogs
│   └── sonobuoy
├── resources
│   ├── cluster
│   └── ns
├── servergroups.json
└── serverversion.json

需要提交给CNCF社区的两个文件就位于plugins/e2e/results/global/{e2e.log,junit_01.xml}

上传结果提交pr

在Github上Fork社区的**[cncf/k8s-conformance]**到自己的仓库,并在指定的Kubernetes目录下创建一个目录。目录要求是一个简短的产品名称。同时将e2e.log和junit_01.xml两个文件伙同产品描述文件(PRODUCT.yaml)一起保存在目录下。具体步骤如下:

字段 Description
vendor 认证的法律实体的名称。该实体必须有一份在CNCF备案的参与表格。
name 被Certified Kubernetes认证的产品名称
version 被Certified Kubernetes认证的产品版本(非Kubernetes版本)
website_url 产品介绍地址
repo_url 如果产品是开源的,就必须指向包含源代码的主要GitHub repo地址。也是可以接受Docker镜像地址。可选的
documentation_url 产品文档地址
product_logo_url 产品Logo地址(必须是 SVG、AI 或者 EPS 格式,且需包含产品名称),如果没有则使用公司的Logo
type 产品类型,包含三种 发行版( product a distribution), 托管平台(hosted platform) 或者安装器(installer)
description 一句话的产品描述文字
如下就是一个样例:
vendor: Harmonycloud
name: Harmonycloud Container Platform
version: v2.11.2
website_url: http://harmonycloud.cn/products/rongqiyun/
documentation_url: http://harmonycloud.cn/products/rongqiyun/
product_logo_url: https://landscape.cncf.io/logos/harmony-cloud-container-platform.svg
type: distribution
description: Harmonycloud Container Platform is an Enterprise Platform-as-a-Service based on Kubernetes
  • fork开源的代码到自己的远程仓库

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cBBnJ4g5-1650183156904)(C:\Users\SQ\AppData\Roaming\Typora\typora-user-images\image-20220417152544027.png)]

  • git clone自己的仓库到本地电脑

    git clone https://github.com/sunsun20/k8s-conformance.git
    
  • 与源代码的github仓库建立新的连接

    git remote add upstream https://github.com/cncf/k8s-conformance.git
    
  • 查看是否成功建立连接

    git remote -v
    反馈信息如下:
    origin git@github 我自己的项目地址upstream http://github.com 开源项目的项目地址
    现在你的本地代码已经与远程代码相连了
    
  • 创建本地分支

    git checkout -b harmonycloud
    git checkout -b harmonycloud-installer //这块是创建了2个分支
    
  • 修改代码

    git add  .
    git commit -m git commit -m "Conformance results for v1.23/Harmonycloud"
    git push origin harmonycloud `将当前分支推送到自己的远程仓库`Git checkout master
    git add  .
    git commit -m git commit -m "Conformance results for v1.23/Harmonycloud-Installer"
    git push origin harmonycloud-installer //这是2个分支的具体根据自己
    
  • 提交pr@taylorwaggoner审核

    注意事项:
    每次PR之前,首先与远程仓库做代码同步(刚才上面的远程仓库链接就是为了做远程代码同步)git fetch upstream
    git rebase upstream/master
    git push origin masterpush完后,远程仓库便可看到你的branch版本和master分支一致了,否则这个位置会显示与master相差了多少次commit。
    

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ULcngW3D-1650183156904)(C:\Users\SQ\AppData\Roaming\Typora\typora-user-images\image-20220417153901154.png)]

通常情况下会在提交后的3个工作日内回复。

  • 清理环境

    运行sonobuoy delete命令即可完成整个测试过程中产生的K8S资源。
    不过如果sonobuoy的测试用例执行失败后不会自动清除,需要用户执行清理残留资源
    

总结

本文主要讲述了我对CNCF社区对Kubernetes一致性认证的理解,以及如何利用Sonobuoy工具来对自己的Kubernetes集群做集成测试。Sonobuoy是一个非常好的集成测试工具,它除了能做Kubernetes一致性测试外,还能做性能测试、存储测试以及厂商自定义的测试。同时,本文还对提交Certified Kubernetes做了一个简单的流程说明。如果有读者的公司正在做相关的工作的话,希望能够帮到你。

附:k8s集群快速搭建

kubeadm的安装方式
--在master和node上执行
1、systemctl stop firewalld && systemctl disable firewalld && setenforce 0;
2、hostname 然后rm -rf /etc/yum.repos.d/*; wget ftp://ftp.rhce.cc/k8s/* -P /etc/yum.repos.d/ //记得先删之前先看有没有wget!!!
3、配置/etc/hosts
4、swapoff -a && sed -i '/swap/d' /etc/fstab
5、yum install docker-ce -y && systemctl enable docker --now
6、设置相关属性
cat <<EOF > /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOFcat > /etc/docker/daemon.json <<EOF { "registry-mirrors": ["https://frz7i079.mirror.aliyuncs.com"], "exec-opts": ["native.cgroupdriver=systemd"] }EOF安装kubernetes相关软件包
yum install -y kubelet-1.23.1-0 kubeadm-1.23.1-0 kubectl-1.23.1-0 --disableexcludes=kubernetes
systemctl restart kubelet ; systemctl enable kubelet--在maser上执行
kubeadm init --image-repository registry.aliyuncs.com/google_containers --kubernetes-version=v1.23.1 --pod- network-cidr=10.244.0.0/16
安装calico网络
wget https://docs.projectcalico.org/v3.20/manifests/calico.yaml --no-check-certificate
kubectl apply -f calico.yaml

restart kubelet ; systemctl enable kubelet

–在maser上执行
kubeadm init --image-repository registry.aliyuncs.com/google_containers --kubernetes-version=v1.23.1 --pod- network-cidr=10.244.0.0/16
安装calico网络
wget https://docs.projectcalico.org/v3.20/manifests/calico.yaml --no-check-certificate
kubectl apply -f calico.yaml

Kubernetes一致性认证相关推荐

  1. 精灵云容器云平台通过Kubernetes一致性认证

    Ghostcloud精灵云专为企业级用户打造的容器云平台EcOS日前通过Kubernetes一致性认证(Certified Kubernetes Conformance Program) .IBM.微 ...

  2. 产品如何做Kubernetes一致性认证

    Certified Kubernetes是CNCF基金会在2018年推出的Kubernetes一致性认证计划.它由CNCF基金会提供的一套诊断测试工具(Sonobuoy)并运行在Kubernetes中 ...

  3. WiseCloud成为全球首批Kubernetes官方认证平台产品-CNCF官方发布

    [新闻快讯]11月13日美国时间,CNCF在旧金山正式对外发布Kubernetes软件一致性项目,并对外公布了包括睿云智合WiseCloud在内的全球32家率先通过认证测试的平台产品及Kubernet ...

  4. WiseCloud成为全球首批Kubernetes官方认证平台产品-睿云智合

    11月13日美国时间,CNCF在旧金山正式对外发布Kubernetes软件一致性项目,并对外公布了包括睿云智合WiseCloud在内的全球32家率先通过认证测试的平台产品及Kubernetest分发版 ...

  5. vault-使用kubernetes作为认证后端

    vault使用kubernetes认证 配置 vault可以使用kubernetes的serviceaccount进 行认证 #在kubernetes为vault创建serviceaccount账号, ...

  6. Kubernetes CKA认证运维工程师笔记-Docker快速入门

    Kubernetes CKA认证运维工程师笔记-Docker快速入门 1. Docker 概念与安装 1.1 Docker 是什么 1.2 Docker 基本组成 1.3 版本与支持平台 1.4 Do ...

  7. 引领SDN网络浪潮 锐捷网络8款SDN交换机获OpenFlow v1.3一致性认证

    在近日举办的2016GNTC全球网络技术大会上,中国数据通信解决方案领导品牌锐捷网络旗下3大系列共8款交换机,通过全球SDN测试认证中心的OpenFlowv1.3一致性测试,获得由ONF颁发的相关认证 ...

  8. Kubernetes CKA认证运维工程师笔记-Kubernetes安全

    Kubernetes CKA认证运维工程师笔记-Kubernetes安全 1. Kubernetes安全框架 2. 鉴权,授权,准入控制 2.1 鉴权 2.2 授权 2.3 准入控制 3. 基于角色的 ...

  9. Kubernetes CKA认证运维工程师笔记-Kubernetes网络

    Kubernetes CKA认证运维工程师笔记-Kubernetes网络 1. Service 存在的意义 2. Pod与Service的关系 3. Service三种常用类型 4. Service代 ...

最新文章

  1. 邀请了阿里的学长学姐分享
  2. .net数据根据字段进行分类(linq语句)
  3. 在SQL SERVER中使用分布式事务
  4. 精算模型10 非参数模型0 精算数据、非参数建模的思路概述
  5. java oca_OCA第7部分中的Java难题
  6. ssh 免密码设置失败原因总结
  7. linux统计多个文件大小总和
  8. java盛最多水的容器_Leetcode刷题java之11. 盛最多水的容器(top100)
  9. 远程访问SOAP协议接口
  10. 通俗解读SGD、Momentum、Nestero Momentum、AdaGrad、RMSProp、Adam优化算法
  11. 计算机图形学-X扫描线
  12. 【图像去噪】基于三边滤波器实现图像去噪附matlab代码
  13. 视频接口CVBS/Component/BNC/VGA/DVI/HDMI/SDI/DP/Type-C
  14. Baumer工业相机堡盟相机如何使用自动曝光功能(自动曝光优点和行业应用)(C++)
  15. gbase 8d客户端配置文件
  16. 苹果笔记本python开发第一个程序_Xcode的第一个mac程序
  17. 人工智能 2. 图像识别
  18. cmos和ccd区别对比
  19. VS2015远程调试
  20. python银行ATM自动取款机

热门文章

  1. BPSK码元速率与带宽的关系
  2. vue 全局监听浏览器窗口关闭以及无痕模式场景提示
  3. python使用selenium启动谷歌浏览器无痕模式代码
  4. 7-6 程序员买西瓜 (5分)
  5. 联想小新pad和pro的区别
  6. 最强量子计算机争霸:谷歌和IBM,谁是真正赢家?
  7. QPixmap的尺寸设置
  8. 关于Ai打开图片,颜色变色问题
  9. 大数相乘 - 浮点数
  10. 本周解锁新技能:识简谱、弹音阶(2019 年 8 月 3日)