2019 年 8 月手记
Kubernetes
object GroupVersionKind is empty
问题
从 client-go (无论是从 server 还是 cache)获取到的 object 的 TypeMeta 为空
1 | pod := podLister.Pods(namespace).Get(name) |
1 | GroupVersionKind{Group:"", Version:"", Kind:""} |
(kubernetes 1.14)
原因
https://github.com/kubernetes/client-go/issues/308#issuecomment-378165425
https://github.com/kubernetes/kubernetes/pull/59264#issuecomment-362575608
https://github.com/kubernetes/apiextensions-apiserver/issues/29#issuecomment-378057230
解决
在需要 GVK 的地方,需要和 object 一起显式传入
controller-runtime 框架从 cache 中获取到对象之后设置了 GVK
https://github.com/kubernetes-sigs/controller-runtime/pull/212
https://github.com/kubernetes-sigs/controller-runtime/pull/389
kubernetes PATCH operations
这篇文档介绍了 kubernetes PATCH 操作的三种策略:
是 json patch 的简化版
strategic merge patch
这篇文档介绍了 kubectl apply 的原理,比如如何通过 patchMergeKey 计算资源的改动,如何通过 strategic merge patch 更新资源:
https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/
这两篇文章分别介绍了如何通过 PATCH API 和 kubectl patch 对资源进行修改操作:
https://dwmkerr.com/patching-kubernetes-resources-in-golang/
daemonset 调度问题
https://github.com/kubernetes/enhancements/issues/548
https://docs.google.com/document/d/10Ch3dhD88mnHYTq9q4jtX3e9e6gpndC78g5Ea6q4JY4/edit#
https://docs.google.com/document/d/1v7hsusMaeImQrOagktQb40ePbK6Jxp1hzgFB9OZa_ew/edit#
node 从资源不足变为满足条件时,daemonset controller 感知不到
https://github.com/kubernetes/kubernetes/issues/46935
https://github.com/kubernetes/kubernetes/issues/45628
webhook
https://medium.com/ibm-cloud/diving-into-kubernetes-mutatingadmissionwebhook-6ef3c5695f74
https://github.com/morvencao/kube-mutating-webhook-tutorial
base image
https://github.com/kubernetes/kubernetes/issues/70249
cilium
https://cilium.io/blog/2019/08/20/cilium-16
kubectl source code
Productive
iterm2 rz sz
https://segmentfault.com/a/1190000012166969
Proxy 配置
https://github.com/shadowsocks/shadowsocks/wiki/Convert-Shadowsocks-into-an-HTTP-proxy
Golang
cgo
https://blog.golang.org/c-go-cgo
https://golang.org/src/cmd/cgo/doc.go
https://dave.cheney.net/tag/cgo
Others
braft
https://github.com/brpc/braft/blob/master/docs/cn/overview.md
tcp delayed ack
https://serverfault.com/questions/834326/questions-about-nagle-vs-delayed-ack