欢迎光临散文网 会员登陆 & 注册

Kubernetes系统精讲 Go语言实战K8S集群可视化(附word文档)

2023-06-13 16:55 作者:快乐学习2012  | 我要投稿

Kubernetes系统精讲 Go语言实战K8S集群可视化(附word文档)

学习地址1:https://pan.baidu.com/s/1LEcLrcqlyP3v6xsyM6T1DQ 提取码:7345 

学习地址2:https://pan.baidu.com/s/1bUEn3WJqWaCoVPO5psB74Q 提取码:zfxr 


Kubernetes系统精讲 Go语言实战K8S集群可视化(附word文档,也就是电子教程,独家提供,其他地方都没有的word文档)


《Kubernetes系统精讲 Go语言实战K8S集群可视化》课程目前更新到第21章,即将完结,大家关注学习地址,有更新会同步进去!!




K8S 适用场景

学习一门技术我们需要了解学了该技术到底能干啥,因此了解K8S适用场景对我们学习课程非常重要。


微服务运维

微服务极大的方便了业务的解耦,但是部署起来就相对比较麻烦了,一般微服务为了保证服务的可用性,都不会只用一台主机,而是主机集群。但是借助于k8s的集群容器编排能力,轻松完成微服务的部署,做到服务的拓展的高可用部署。


CI/CD

CI/CD就是咱们常说的持续集成与持续发布,传统的持续集成,例如小伙伴们非常熟悉的Jenkins,可以做到流水线的配置,远程到目标主机操作。


如果在K8S的加持下,我们远程到的目标主机是Master节点,或者是配置了ApiServer访问,借助于K8S的统一编排,那么我们便可以做到集群场景的持续集成与发布。


虚拟机与Docker

了解了全虚拟化与半虚拟化的区别,现在我们来看看虚拟机和Docker的区别。


![image-20230320075320368](/Users/morris/Library/Application Support/typora-user-images/image-20230320075320368.png)


如图所示我们可以看到,Docker就是一种半虚拟机技术,Docker上运行的容器,其实就是资源隔离的进程,而这些资源隔离的进程,就是我们常说的容器。


另外我们再来虚拟机,在物理操作系统的基础上,则是在物理操作系统上抽象出来一整套的操作系统。


Pod详情查看

Pod详情查看,这里的作用是将K8S查询的数据,转为提交Pod创建的数据结构,用于查看并且更新。


func (this *K8s2ReqConvert) PodK8s2Req(podK8s corev1.Pod) pod_req.Pod {

return pod_req.Pod{

Base:           getReqBase(podK8s),

NetWorking:     getReqNetworking(podK8s),

Volumes:        this.getReqVolumes(podK8s.Spec.Volumes),

Containers:     this.getReqContainers(podK8s.Spec.Containers),

InitContainers: this.getReqContainers(podK8s.Spec.InitContainers),

}

}


func getReqContainerProbe(probeK8s *corev1.Probe) pod_req.ContainerProbe {

containerProbe := pod_req.ContainerProbe{

Enable: false,

}

//先判断是否探针为空

if probeK8s != nil {

containerProbe.Enable = true

//再判断 探针具体是什么类型

if probeK8s.Exec != nil {

containerProbe.Type = probe_exec

containerProbe.Exec.Command = probeK8s.Exec.Command

} else if probeK8s.HTTPGet != nil {

containerProbe.Type = probe_http

httpGet := probeK8s.HTTPGet

headersReq := make([]pod_req.ListMapItem, 0)

for _, headerK8s := range httpGet.HTTPHeaders {

headersReq = append(headersReq, pod_req.ListMapItem{

Key:   headerK8s.Name,

Value: headerK8s.Value,

})

}

containerProbe.HttpGet = pod_req.ProbeHttpGet{

Host:        httpGet.Host,

Port:        httpGet.Port.IntVal,

Scheme:      string(httpGet.Scheme),

Path:        httpGet.Path,

HttpHeaders: headersReq,

}

} else if probeK8s.TCPSocket != nil {

containerProbe.Type = probe_tcp

containerProbe.TcpSocket = pod_req.ProbeTcpSocket{

Host: probeK8s.TCPSocket.Host,

Port: probeK8s.TCPSocket.Port.IntVal,

}

} else {

containerProbe.Type = probe_http

return containerProbe

}

containerProbe.InitialDelaySeconds = probeK8s.InitialDelaySeconds

containerProbe.PeriodSeconds = probeK8s.PeriodSeconds

containerProbe.TimeoutSeconds = probeK8s.TimeoutSeconds

containerProbe.SuccessThreshold = probeK8s.SuccessThreshold

containerProbe.FailureThreshold = probeK8s.FailureThreshold

}

return containerProbe

}


Kubernetes系统精讲 Go语言实战K8S集群可视化(附word文档)的评论 (共 条)

分享到微博请遵守国家法律