cloud
ipvs load balancer
· ☕ 1 åˆ†é’Ÿ
IPVS as load balancer https://medium.com/@benmeier_/a-quick-minimal-ipvs-load-balancer-demo-d5cc42d0deb4 Get stats $ sudo ipvsadm -L -n --stats --rate IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Conns InPkts OutPkts InBytes OutBytes -> RemoteAddress:Port TCP 1.2.3.4:80 80 560 400 36000 41040 -> 172.17.0.3:80 22 154 110 9900 11286 -> 172.17.0.4:80 58 406 290 26100 29754 Ref. https://medium.com/@benmeier_/a-quick-minimal-ipvs-load-balancer-demo-d5cc42d0deb4 https://debugged.it/blog/ipvs-the-linux-load-balancer/

kube-proxy
· ☕ 1 åˆ†é’Ÿ
Ref. Evolution_of_kube_proxy.pdf https://arthurchiao.art/blog/cracking-k8s-node-proxy/

Bytebuddy
· ☕ 0 åˆ†é’Ÿ

K8s Custom Resources(CR)
· ☕ 2 åˆ†é’Ÿ
Custom Resource 的入口 请求是这样分发到 api 扩展点的: 例如我们有 (Custom Resource)CR 1 2 3 4 5 6 7 8 apiVersion:cnat.programming-kubernetes.info/v1alpha1kind:Atmetadata:name:example-atspec:schedule:"2019-07-03T02:00:00Z"status:phase:"pending" 相应的 CustomResourceDefinition (CRD) 会是这样: 1 2 3 4 5 6 7 8 9

K8s API 核心对象 —— client-go
· ☕ 3 åˆ†é’Ÿ
API 入口 Client Sets 接收变更通知和缓存(Informers and Caching) Client Sets可以 watch 变更,但一般我们用更高级的 Informers,因为它有缓存

Helm base
· ☕ 1 åˆ†é’Ÿ
Concept umbrella chart you can also create a chart with dependencies to other charts (a.k.a. umbrella chart) which are completely external using the requirements.yaml file. versioning Simple 1-1 versioning Chart versus application versioning 参考 https://codefresh.io/docs/docs/new-helm/helm-best-practices/

Kubernetes extends concept
· ☕ 3 åˆ†é’Ÿ
前言 最近由于工作需要,重新系统回顾 Kubernetes 的编程。发现《Programming Kubernetes》这书写得比较系统。于是边学,边记录一些重点。 Controller

helm GO SDK
· ☕ 1 åˆ†é’Ÿ
参考 https://helm.sh/docs/topics/advanced/#go-sdk https://pkg.go.dev/helm.sh/helm/v3

Kubernetes 自动扩缩容
· ☕ 1 åˆ†é’Ÿ
本文状态:草稿 配置例子 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 apiVersion:autoscaling/v2beta2kind:HorizontalPodAutoscalermetadata:name:php-apachespec:scaleTargetRef:apiVersion:apps/v1kind:Deploymentname:php-apacheminReplicas:1maxReplicas:10metrics:- type:Resourceresource:name:cputarget:type:UtilizationaverageUtilization:50 算法 desiredReplicas = ceil[currentReplicas * ( currentMetricValue / desiredMetricValue )] currentMetricValue 为相关 pod 的 metric 平均数。 If multiple metrics are specified in a HorizontalPodAutoscaler, this calculation is done for each metric, and then

Istio Canary(金丝雀) 上线
· ☕ 1 åˆ†é’Ÿ
按比例分配分配新旧版本流量 VirtualService: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 apiVersion:networking.istio.io/v1alpha3kind:VirtualServicemetadata:name:reviewsspec:hosts:- reviewshttp:- route:- destination:host:reviewssubset:v1weight:75- destination:host:reviewssubset:v2weight:25 DestinationRule : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 apiVersion:networking.istio.io/v1alpha3kind:DestinationRulemetadata:name:bookinfo-ratingsspec:host:reviewstrafficPolicy:loadBalancer:simple:LEAST_CONNsubsets:- name:v1labels:version:v1trafficPolicy:loadBalancer:simple:ROUND_ROBIN- name:v2labels:version:v2trafficPolicy:loadBalancer:simple:ROUND_ROBIN 根据请求源 pod 的