2019 年 8 月手记

Kubernetes

object GroupVersionKind is empty

问题

从 client-go (无论是从 server 还是 cache)获取到的 object 的 TypeMeta 为空

1
2
3
pod := podLister.Pods(namespace).Get(name)
gvk := pod.GetObjectKind().GroupVersionKind()
fmt.Printf("%#v\n", gvk)
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 操作的三种策略:

https://github.com/kubernetes/kubernetes/blob/release-1.1/docs/devel/api-conventions.md#patch-operations

这两篇文章分别介绍了如何通过 PATCH API 和 kubectl patch 对资源进行修改操作:

https://dwmkerr.com/patching-kubernetes-resources-in-golang/

https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#notes-on-the-strategic-merge-patch

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

https://github.com/kubernetes/enhancements/blob/master/keps/sig-release/20190316-rebase-images-to-distroless.md

https://github.com/kubernetes/sig-release/blob/master/release-engineering/baseimage-exception-list.md

cilium

https://cilium.io/blog/2019/08/20/cilium-16

kubectl source code

https://developer.ibm.com/opentech/2017/06/21/tour-kubernetes-source-code-part-one-kubectl-api-server/

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/cmd/cgo/

https://golang.org/src/cmd/cgo/doc.go

https://dave.cheney.net/tag/cgo

https://dominik.honnef.co/posts/2015/06/statically_compiled_go_programs__always__even_with_cgo__using_musl/

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

Author

whypro

Posted on

2019-08-01

Updated on

2022-11-11

Licensed under

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×