「K8S 生态周报」内容主要包含我所接触到的 K8S 生态相关的每周值得推荐的一些信息。欢迎订阅知乎专栏「k8s生态」。
”
Istio 1.6.7 是为了解决在 1.6.6 中引入的一个 bug[1]。
该 bug 可能会导致 在使用 Istio 1.6.6 时,某些 Pod 进入 CrashLoopBackOff 状态,无法正常提供服务。
修复后的核心代码如下,这里主要是增加另一个返回值 expectpod 。
通过此方法获取 Pod 时,Pod 有两种情况可能为空:
false;true而这种情况发生的最主要原因可能是由于最终一致性,或者乱序事件等。
建议如果打算升级 Istio 的读者,直接跳过 1.6.6 版本,以免影响到服务。
func getPod(c *Controller, ip string, ep *metav1.ObjectMeta, targetRef *v1.ObjectReference, host host.Name) (rpod *v1.Pod, expectPod bool) {pod := c.pods.getPodByIP(ip)if pod != nil {return pod, false}if targetRef != nil && targetRef.Kind == "Pod" {key := kube.KeyFunc(targetRef.Name, targetRef.Namespace)podFromInformer, f, err := c.pods.informer.GetStore().GetByKey(key)if err != nil || !f {log.Debugf("Endpoint without pod %s %s.%s error: %v", ip, ep.Name, ep.Namespace, err)endpointsWithNoPods.Increment()if c.metrics != nil {c.metrics.AddMetric(model.EndpointNoPod, string(host), nil, ip)}epkey := kube.KeyFunc(ep.Name, ep.Namespace)c.pods.queueEndpointEventOnPodArrival(epkey, ip)return nil, true}pod = podFromInformer.(*v1.Pod)}return pod, false}
本周 Trivy 相继发布了 v0.10.0 和 v0.10.1 版本,我们一起来看看有哪些值得关注的内容吧:
--severity 选项进行过滤,只查看特定级别的漏洞信息(MoeLove) ➜ ~ trivy i --severity LOW alpine:3.10.2alpine:3.10.2 (alpine 3.10.2)=============================Total: 1 (LOW: 1)+---------+------------------+----------+-------------------+---------------+--------------------------------+| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |+---------+------------------+----------+-------------------+---------------+--------------------------------+| openssl | CVE-2019-1547 | LOW | 1.1.1c-r0 | 1.1.1d-r0 | openssl: side-channel weak || | | | | | encryption vulnerability |+---------+------------------+----------+-------------------+---------------+--------------------------------+
比方说,我们想要实现和上面使用 --severity LOW 参数相同的效果,那我们可以定义如下 rego 规则文件。注意:包名必须为 trivy ,同时,它还必须包含一个名为 ignore 的规则。
(MoeLove) ➜ ~ cat test_trivy.regopackage trivyignore {input.Severity == {"UNKNOWN", "MEDIUM", "HIGH", "CRITICAL"}[_]}
通过给 trivy 传递 --ignore-policy 参数即可。(这里一定要注意搞清楚逻辑, trivy 的参数为忽略掉匹配成功的规则。)
(MoeLove) ➜ ~ trivy image --ignore-policy test_trivy.rego alpine:3.10.2alpine:3.10.2 (alpine 3.10.2)=============================Total: 1 (UNKNOWN: 0, LOW: 1, MEDIUM: 0, HIGH: 0, CRITICAL: 0)+---------+------------------+----------+-------------------+---------------+--------------------------------+| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |+---------+------------------+----------+-------------------+---------------+--------------------------------+| openssl | CVE-2019-1547 | LOW | 1.1.1c-r0 | 1.1.1d-r0 | openssl: side-channel weak || | | | | | encryption vulnerability |+---------+------------------+----------+-------------------+---------------+--------------------------------+
CweIDs 字段。(MoeLove) ➜ ~ trivy image -f json --ignore-policy test_trivy.rego alpine:3.10.2[{"Target": "alpine:3.10.2 (alpine 3.10.2)","Type": "alpine","Vulnerabilities":{"VulnerabilityID": "CVE-2019-1547","PkgName": "openssl","InstalledVersion": "1.1.1c-r0","FixedVersion": "1.1.1d-r0","CweIDs": ["CWE-311"],...}}]
--list-all-pkgs 选项,允许输出被扫描系统中已经安装的包及其版本等。而后续发布的 v0.10.1 版本主要是为了修正 v0.10.0 中对 Dockerfile 中执行用户的修改,继续使用 root 用户作为容器镜像中的默认用户 。
更多关于此版本的信息,请查看 Trivy ReleaseNote[6], 欢迎下载使用。
通过此次修改,Kubelet 使用 systemd 作为 cgroups 驱动时,能正常的处理 CPU 核数大于 512 的机器(如果使用 cgroupfs 作为 cgroup 驱动的话,一直都可以,因为内核会直接进行处理)
有关 Linux 内核 CFS 相关内容,可以参考我之前写的文章 Docker 容器资源管理[8]
欢迎订阅我的文章公众号【MoeLove】

Istio 1.6.6 中引入的 bug: https://github.com/istio/istio/commit/bae28dde42cf54e213d4c6bcd9c930f8d9ee60c4
[2]#559: https://github.com/aquasecurity/trivy/pull/559
[3]#562: https://github.com/aquasecurity/trivy/pull/562
[4]#561: https://github.com/aquasecurity/trivy/pull/561
[5]#574: https://github.com/aquasecurity/trivy/pull/574
[6]Trivy ReleaseNote: https://github.com/aquasecurity/trivy/releases/tag/v0.10.1
[7]#93248: https://github.com/kubernetes/kubernetes/pull/93248
[8]Docker 容器资源管理: https://gitbook.cn/gitchat/column/5d70cfdc4dc213091bfca46f
原文作者:MoeLove;如有侵权,请联系管理员删除。