Go Programming Pattern in Kubernetes PhilosophyGo Programming Pattern in Kubernetes Philosophy Harry Zhang @resouer Contents • What I will talk? • Kubernetes basic in 1 min • For Kubernetes developers: • The Golang programming patterns of popular open source projects in this world • Written by, and heavily depends on Golang Again: Why Go? • All about community • A sad story: • https://github.com/google/lmctfy • Now think about a of all Asta Xie instances $ kubectl get astaxie NAME KIND astaxie1 AstaXie.v1.cr.client-go.k8s.io My AstaXie Object & Controller etcd kube-apiserver types register AstaXie Controller0 码力 | 29 页 | 2.12 MB | 1 年前3
Operator Pattern 用 Go 扩展 Kubernetes 的最佳实践Operator Pattern:用 Go 扩展 K8s 的最佳实践 吴学强 ApeCloud KubeBlocks Maintainer & 研发总监 目 录 认识我们 00 什么是 Operator 01 Operator 基础模型 02 Operator 最佳实践 03 我们是谁 云猿生(ApeCloud)是一家提供数据库内核与管理平台的基 础软件开发商. KubeBlocks 域的复杂有状态应用程序。 给出了用 TPR + controller- runtime 早期版本的 sample: etcd operator K8s 1.9 版本发布,CRD进入 beta 阶段并正式取代 TPR; controller-runtime 加入 K8s 社 区并正式发布; 自此,CRD + controller-runtime 逐渐成为开发 operator 的首选 Operator Operator = CRD + control loop, i.e, Declaretive API + Automation; kubebuilder + controller-runtime + helm Operator Capability Levels Installation of the workload • Operator deploys an Operand0 码力 | 21 页 | 3.06 MB | 9 月前3
石墨文档Go在K8S上微服务的实践-彭友顺石墨文档GO在K8S上微服务的实践 彭友顺 石墨文档 基础设施负责人 目 录 1 架构演进 01 2 微服务的生命周期 02 3 如何管理好微服务 03 架构演进 第一部分 架构演进 单体应用时期 垂直应用时期 微服务时期 快速、简单 耦合强 隔离、稳定 复制多 隔离、稳定 复用高 架构演进 组件增多 架构复杂 维护困难 架构演进 传统模式 K8S模式 format、lint、breaking 检查。 CI build 阶段 • 会基于 pb 的注释自动产生文档,并推送至内部的微服务管理系统接口平台中 • 会生成 Go/PHP/Node/Java 桩代码和错误码,推送到指定的仓库 开发阶段 • go get 客户端、服务端的gRPC和错误码的代码 配置 对接 Debug • 配置驱动 • 配置补齐 • 配置工具 • Proto的管理 • 配置补齐 • 配置工具 • Proto的管理 • 错误码管理 • 调试gRPC • 调试信息 • 错误定位 Generate • protoc -I {error proto file} --go-errors_out={output directory} • 实现我们自定义的error类型,方便断言。 • 根据注解的code信息,在错误码中生成对应的grpc status code •0 码力 | 41 页 | 3.20 MB | 1 年前3
QCon北京2017/智能化运维/Self Hosted Infrastructure:以自动运维 Kubernetes 为例● ... Installation - SSH - Install kubelet - $pkgmanager install kubelet - Install container runtime - $pkgmanager install [docker|rkt] - Start kubelet - Systemctl start kubelet Installation - master kops, kubeup.sh, kube-AWS,... AWS, GCP API node1 node2 node3 Upgrade - SSH - Upgrade container runtime - Upgrade Kubelet Upgrade - master - SSH - Upgrade master components Upgrade - etcd - SSH - Upgrade main() { compile_c(argv[1]); } gcc Self hosting go // golang source code package main import "os" func main() { compile_go(os.Args[1:]) } go Self hosting Self hosting $ uname -s minix $ gcc0 码力 | 73 页 | 1.58 MB | 1 年前3
Over engineeringthe core of Kubernetes kopse c t . . Kris Nova ..to Kris Nova Microsoft ACS ..while working at... Kris Nova Kris Nova go/AUTHORS Kris Nova r/golang Thanks Renee French! Kris Nova “I speak for the software..” # -- vpc: vpc/{{ ClusterName }} dhcpOptions: dhcpOptions/{{ ClusterName }} {{ end }} Over Engineering Go in Kubernetes # --------------------------------------------------------------- # Zones (Availability cloud” - Kris Nova Kubernetes Kops Kubernetes Operations Statically linked CLI tool written in Go Kubernetes Kops Kubernetes Operations import “k8s.io/kubernetes” Kubernetes Kops Kubernetes Operations0 码力 | 75 页 | 4.56 MB | 1 年前3
Kubernetes开源书 - 周立Kubernetes为主要⽤于集群内通信的API实现了另⼀种基于Protobuf的序列化格式,在 design proposal 有记录,每个 schema的IDL⽂件都存放在定义该API对象的Go语⾔包中。 API版本 为了更容易地消除字段或重组资源表示,Kubernetes⽀持多种API版本,每种API版本都有不同的API路径,例 如 /api/v1 或 /apis/extensions/v1beta1 默认情况下,某些资源和API组已被启⽤。可通过在apiserver上设置 --runtime-config 来启⽤或禁⽤它们。 -- runtime-config 接受逗号分隔的值。例如:要禁⽤ batch / v1 ,请设置 --runtime-config=batch/v1=false ;想启 ⽤ batch/v2alpha1 ,可设置 --runtime-config=batch/v2alpha1 。 -manager来获取 --runtime-config 的更改。 启⽤组中的资源 默认情况下,DaemonSets、Deployments、HorizontalPodAutoscalers、Ingress、Jobs和ReplicaSets都被启⽤。可通 过在apiserver上设置 --runtime-config 来启⽤其他扩展资源。 --runtime-config 接受逗号分隔值。0 码力 | 135 页 | 21.02 MB | 1 年前3
破解 Kubernetes 应用开发困局-王炜定义容器启动命令 对应容器 PID=1 的进程 1 4 从 Dockerfile 说起 go run cmd/aslan/main.go 缺少:源码、Golang Runtime 1 5 从 Dockerfile 说起 还缺三个条件: 1、源码从哪来? 2、Golang Runtime 从哪来? 3、PID=1 的进程替换成源码运行,如果进程停 止,容器将 Crash,怎么阻止? Crash,怎么阻止? 解决问题: 1、从本地同步到容器 2、将业务容器的镜像替换为 Runtime 镜像 3、替换 PID=1 进程为阻塞进程: /bin/sh -c tail -f /dev/null 1 6 从 Dockerfile 说起 开发和调试演示 04 一键 Run、一键 Debug 1 8 使用 Nocalhost 开发 Zadig 组件 教程:https://koderover0 码力 | 20 页 | 3.58 MB | 9 月前3
QCon北京2018/QCon北京2018-《Kubernetes-+面向未来的开发和部署》-Michael+ChenPhysical Infrastructure Containers VMware Hypervisor VMs Docker Containers User Cases 9 •Ready-to-go development •Self-service portal Developer Sandbox • New application development • 12-factor apps kube-controller-manager kube-Scheduler Worker Node CRI-containerd Kubeproxy Kubelet • Container Runtime Interface • Responsible for downloading images • Runs containers • Can use other runtimes such Creates virtual IP for external access • Interfaces with local iptables The Kubernetes Runtime Components • Runtime Objects Component Description Pods A grouping of one or more containers as an atomic0 码力 | 42 页 | 10.97 MB | 1 年前3
Putting an Invisible Shield on Kubernetes Secretsservers do not meet API servers’ performance requirements • Solution • Same TEE-based KMS-plugin runtime • Deployment modes • N (>=3) SGX servers deployed w/ sgx-device- plugin daemonset [1] • kms-plugins Hardware configurations • Biz scenarios • Solutions evaluated • Go KMS Plugin + C Go SGX Functions • C++ KMS Plugin • Rust KMS Plugin ü Go KMS Plugin + TEE LibOS (Occlum [1]) [1] https://github.com/occlum/occlum kubectl completed PoC • API server and the rest changes for the TEE-based - PoC stage • Where we go? • To keep the production practice • To explore more potential intersections between Cloud-Native0 码力 | 33 页 | 20.81 MB | 1 年前3
01. K8s扩展功能解析ns(beta) • Support for extensible admission controllers • Pluggable cloud providers • Container runtime interface (CRI) enhancements © 2017 Rancher Labs, Inc. CustomResourceDefinition(CRD) • What CRD Download and install the latest version of apiserver-builder • Create project path in your GOPATH • Go into your project path and init your project ‘your-domain’ would be like your private tenant name0 码力 | 12 页 | 1.08 MB | 1 年前3
共 30 条
- 1
- 2
- 3













