ASP.NET Core微服务 on K8S(第1章:详解基本对象及服务发现)--学习笔记
2019-07-31 01:02
645 查看
课程链接:http://video.jessetalk.cn/course/explore
良心课程,大家一起来学习哈!
任务1:课程介绍
任务2:Labels and Selectors
所有资源对象(包括Pod, Service, Namespace, Volume)都可以打 Label,定义标签
Selectors:=, !=, in, not in, and 关系
#deploy.yaml apiVersion: apps/v1 kind: Deployment metadata: name: k8s-demo namespace: netcore labels: name: k8s-demo spec: replicas: 2 #2个实例 selector: #该selector用于匹配Pod,对应15行的labels matchLabels: name: k8s-demo template: metadata: labels: name: k8s-demo #给Pod打标签 spec: containers: - name: k8s-demo image: jessetalk/k8s-demo ports: - containerPort: 80 imagePullPolicy: Always --- kind: Service apiVersion: v1 metadata: name: k8s-demo namespace: netcore spec: type: NodePort ports: - port: 80 targetPort: 80 selector: #该selector用于选择Deployment的Pod,对应15行的labels name: k8s-demo #用Selectors来将Service绑定到Pod
#kubectl label selectors 查询(使用 kubectl 来针对 apiserver ,并且使用Equality-based的条件) $ kubectl get pods -l environment=production,tier=frontend
任务3: Pod(容器组)的数据无状态与生命周期
持久性:无状态(数据没有保存)
为何如此设计?
- 高可用,当发生一些删除或者维护的过程时,Pod会自动的在他们被终止之前创建新的替代
- 解偶控制器和服务,后段管理器仅仅监控Pod
- 调度和管理的易用性
Pod phase
- 挂起(Pending):Pod 已被 Kubernetes 系统接受,但有一个或者多个容器镜像尚未创建。等待时间包括调度 Pod 的时间和通过网络下载镜像的时间,这可能需要花点时间。
- 运行中(Running):该 Pod 已经绑定到了一个节点上,Pod 中所有的容器都已被创建。至少有一个容器正在运行,或者正处于启动或重启状态。
- 成功(Succeeded):Pod 中的所有容器都被成功终止,并且不会再重启。
- 失败(Failed):Pod 中的所有容器都已终止了,并且至少有一个容器是因为失败终止。也就是说,容器以非0状态退出或者被系统终止。
- 未知(Unknown):因为某些原因无法取得 Pod 的状态,通常是因为与 Pod 所在主机通信失败。
Pod conditions(history)
The type field is a string with the following possible values:
- PodScheduled: the Pod has been scheduled to a node;
- Ready: the Pod is able to serve requests and should be added to the load balancing pools of all matching Services;
- Initialized: all init containers have started successfully;
- Unschedulable: the scheduler cannot schedule the Pod right now, for example due to lacking of resources or other constraints;
- ContainersReady: all containers in the Pod are ready.
#查看pod kubectl describe pod -l name-k8s-demo -n netcore
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。
欢迎转载、使用、重新发布,但务必保留文章署名 郑子铭 (包含链接: http://www.cnblogs.com/MingsonZheng/ ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。
如有任何疑问,请与我联系 (MingsonZheng@outlook.com) 。
相关文章推荐
- (8)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- Ocelot网关(Api GateWay)
- (5)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- 熔断降级(Polly)
- ASP.NET Core分布式项目实战(第1章:Identity Server 4 准备)--学习笔记
- (7)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- 利用Polly+AOP+依赖注入封装的降级框架
- (9)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- JWT算法
- (6)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- AOP框架
- 【ASP.NET CORE】 Surging 分布式微服务框架学习笔记(1)
- ASP.NET Core on K8S深入学习(3)Deployment
- ASP.NET Core on K8S深入学习(1)K8S基础知识与集群搭建
- ASP.NET Core on K8S深入学习(7)Dashboard知多少
- ASP.NET Core on K8S深入学习(2)部署过程解析与Dashboard
- (11)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- Thrift高效通讯 (完结)
- (10)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- Ocelot+Identity Server
- ASP.NET Core on K8S学习初探(2)K8S基本概念快速一览
- OpenCv学习笔记(四)--Mat基本图像容器Mat对象信息头,矩阵体的创建,深复制,浅复制详解
- ASP.NET Core2.0 学习笔记(一)
- ASP.NET Core 2 学习笔记(十四)Filters
- CoreJava学习笔记1-基本概念、对象和类
- ASP.NET MVC 学习笔记-7.自定义配置信息 ASP.NET MVC 学习笔记-6.异步控制器 ASP.NET MVC 学习笔记-5.Controller与View的数据传递 ASP.NET MVC 学习笔记-4.ASP.NET MVC中Ajax的应用 ASP.NET MVC 学习笔记-3.面向对象设计原则
- ASP.NET 3.5核心编程学习笔记:针对AJAX应用程序的WCF服务