当前位置:网站首页>Kubernetes:(八)调度约束和故障排查
Kubernetes:(八)调度约束和故障排查
2022-08-03 01:01:00 【糖醋·小排顾】
目录
一:调度约束的各个组件流程图
Kubernetes通过watch的机制进行每个组件的协作,每个组件之间的设计实现了解耦。
二:基本调度方式
默认调度策略Default-scheduler:预选、优选+打分
以下是指定调度:
- nodeName用于将Pod调度到指定的Node名称上(跳过调度器直接分配)
- nodeSelector用于将Pod调度到匹配Label的Node上(需要经过调度器(不会进行预选和预选的打分))基于标签形式的调度
三:操作实例
3.1示例1nodeName
vim pod1.yaml
kubectl apply -f pod5.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-example
labels:
app: nginx
spec:
nodeName: node01
containers:
- name: nginx
image: nginx:1.14
kubectl get pods -o wide
#查看详细事件(发现未经过调度器)
kubectl describe pod pod-example
#清空pod
kubectl delete -f .
3.2示例2nodeSelector
#查看标签用法
kubectl label --help
Usage:
kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N
[--resource-version=version] [options]
#需要获取node上的NAME名称
kubectl get node
#给对应的node设置标签分别为kenan=sishen和shuiwu=wodi
kubectl label nodes node01(节点名字为none的用IP) kenan=sishen
kubectl label nodes node02 shuiwu=wodi
#查看标签
kubectl get nodes --show-labels
vim pod2.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-example
labels:
app: nginx
spec:
nodeSelector:
kenan: sishen
containers:
- name: nginx
image: nginx:1.14
vim pod5.yaml
kubectl create -f pod5.yaml
kubectl get pods -o wide
#查看详细事件(通过事件可以观察经过调度器分配)
kubectl describe pod pod-example
四:故障排查
状态表
#查看pod事件
kubectl describe TYPE NAME_PREFIX
#查看pod日志(Failed状态下)
kubectl logs POD_NAME
#进入pod(状态为running,但是服务没有提供)
kubectl exec –it POD_NAME bash
边栏推荐
猜你喜欢
随机推荐
【SQL】—数据库操作、表操作
Day017 封装
Auto.js special positioning control method cannot perform blocking operations on the ui thread, please use setTimeout instead
PyCharm中常用的快捷键用法详解
北路智控上市首日破发:公司市值59亿 募资15.6亿
粘包与拆包
聊聊 Nacos
一个人的精力
6-接口跨域处理
【遥控器开发基础教程4】疯壳·开源编队无人机-SPI(OLED)
Go高性能之方法接收器 - 指针vs值
7-Redis工具类
NVM和NRM
OpenWRT设置ipv6网络
Carefully organize 16 MySQL usage specifications to reduce problems by 80% and recommend sharing with the team
apache-activemq-5.14.1
华为防火墙双机热备技术:HRP、VGMP、VRRP,三大技术值得一学!
从 npm 切换到 pnpm,真香!
Introduction to agile development
Brute force recursion to dynamic programming 07 (516. Longest palindrome subsequence)