Kubernetes_初见

Kubernetes发展史

  • K8S已经有了5年的发展史,由谷歌的Brog演进而来

  • 原生操作:应用部署在服务器中

  • 升级操作:利用虚拟化技术,较为笨重

  • docker操作:容器化技术,屏蔽不同操作系统的细节

多种不同类型的云服务器,docker engine当前运行的环境进行迁移的话。不用类型的云服务器之间进行迁移,迁移成本会比较大。
有了kubernetes技术之后,所有的容器编排都可以运行在K8S之上
gRPC:服务层面远程调用
Linked:解决代理转发流量问题
云原生组织项目:K8S——基础设施支撑
云原生:不管运行在哪一种云上,还是熟悉的样子
容器编排技术:Kubernetes

Kubernetes做容器编排
Docker Swarm也做容器编排

Kubernetes

学习之旅开始-了解基本组件概念

Pod

  • K8S如何管理container
  • K8S的最小操作单元是pod,pod是一个或者多个container的组合
    • pod是什么?pod是一个和多个container的组合,共享存储和网络

ReplicaSet

  • 主要用来平衡、稳定pod的运行,用来管理pod。可以指定pod的数量
  • 本质就是定义多少个pod来运行的
  • 官方解释
A Replicaset is defined with fields, including a selector that specifies how to identify pods it can acquire, a number of 
replicas indicating how many pods it should be maintaining,and a pod template specifying the data of new pods it should create to meet the number of replicas criteria.

	副本集是用字段定义的。包含一个选择器指定如何识别它可以获取的pod。表示应该维护多少个pod的副本。和一个pod模版指定它应该创建的新的pod的数据以满足副本数量标准

Deployment

  • 用来管理 ReplicaSet 和 Pod
  • 官方解释
A Deployment controller provides declarative updates for Pods and Replicasets.

You describe a desired state in a Deployment, and the Deployment controller changes the actual state to the desired state at a 

controlled rate. You can define Deployments to create new Replicasets, or to remove existing Deployments and adopt all their 

resources with new Deployments.


部署控制器为pod和副本集提供声明式更新
你描述了部署中所需要的状态,并且部署控制器以受控速率将实际状态改为期望状态。你可以定义部署去创建新的副本集,或者移除已经存在的部署并采用其资源去做新的部署

Service

Pod分类

  • 使用key-value的形式对pod进行分门别类,称之为标签
  • 使用 LABEL 来管理这些标签
  • Pod之间如何进行关联?
  • 把拥有相同类型LABEL的Pod称之为Service
  • 在Service中有 selector 选择器,用来选择拥有相同lable标签的pod
  • 官方解释
label are key/value pairs that are attached to objects, such as pods

标签是附加到对象(如pod)上的键值对
An abstract way to expose an application running on a set of pods as a network service.

with kubernetes you do not need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives 

pods their own IP addresses and a single DNS name for a set of Pods, and can load-balance across them


以一种抽象的方式将运行在一组POD上应用程序公开为网络服务。
使用kubernetes,你不需要使用不熟悉服务发现机制去更新你的应用程序
Kubernetes分配给pods属于它们自己的IP地址以及给一组pod分配一个单独的DNS名称,并且能够通过它们实现负载均衡

LABEL

  • 每个pod存在的标签被称为LABEL

Node

  • 我们的pod最终会运行在一个个node节点上,node在k8s集群中的worker节点
A node is a worker machine in Kubernetes, previously known as a minion.A node may be a VM or physical machine, depending on the 

cluster.Each node contains the services necessary to run pods and is managed by the master components.


节点是Kubernetes的工作机器,之前被称为仆从。节点可以是虚拟机或者物理机器,具体取决于集群。每一个节点都包含着必须的服务去运行pod并且由master组件去管理。

工作流程

集群的入口

  • 请求如何到达主节点

kubectl

  • 操作集群的命令组件

  • 在访问入口之前需要进行 认证/授权

  • 请求到达,API Server :运行在manager节点,接收 kubectl 传过来的请求

  • 收到请求之后,pod创建在那个节点?需要一个策略来决定——Scheduler

  • 选择好节点之后,谁来进行具体的发送请求?由Manager节点中的 Controller Manager 去进行分发

  • 请求发送之后,在worker节点中如何接收请求?kube-proxy 运行在worker节点,进行接收请求

  • 接下来创建pod,每一个worker节点拥有 kubelet 组件可以用来创建 pod

  • pod中运行着container,所有每一个worker节点中有着 docker 环境的支撑,即 docker engine

分布式存储

  • 作为集群,集群中的内容需要进行存储
  • etcd组件是Kubernetes用来进行分布式存储的组件

域名解析

  • pod可能运行在不同的node节点上。
  • 如何进行访问?
  • Kubernetes提供dns组件专门去做域名解析

可视化界面

  • Dashboard组件提供可视化界面去展示整个集群状态

猜你喜欢

转载自blog.csdn.net/GoNewWay/article/details/109135697