Python微信订餐小程序课程视频

https://edu.csdn.net/course/detail/36074

Python实战量化交易理财系统

https://edu.csdn.net/course/detail/35475目录

  • 查看daemonset
  • 学习kube-flannel-ds
  • 学习kube-proxy,查看daemonset配置
  • 运行自己的DaemonSet失败

kubernetes运行应用1之Deployment详解

回到顶部## 查看daemonset

如下,k8s自身的 DaemonSet kube-flannel-ds和kube-proxy分别负责在每个结点上运行flannel和kube-proxy组件daemonset在每个节点上最多只能运行一个副本。

[machangwei@mcwk8s-master ~]$ kubectl get daemonset
No resources found in default namespace.
[machangwei@mcwk8s-master ~]$ kubectl get daemonset  --namespace=kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-flannel-ds   3         3         1       3            1            5d
kube-proxy 3 3 3 3 3 kubernetes.io/os=linux 5d
[machangwei@mcwk8s-master ~]$ kubectl get pod --namespace=kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-6d8c4cb4d-cnj2t 1/1 Running 0 5d 10.244.0.2 mcwk8s-master
coredns-6d8c4cb4d-ngfm4 1/1 Running 0 5d 10.244.0.3 mcwk8s-master
etcd-mcwk8s-master 1/1 Running 0 5d 10.0.0.4 mcwk8s-master
kube-apiserver-mcwk8s-master 1/1 Running 1 (13h ago) 5d 10.0.0.4 mcwk8s-master
kube-controller-manager-mcwk8s-master 1/1 Running 5 (80m ago) 5d 10.0.0.4 mcwk8s-master
kube-flannel-ds-cn4m9 0/1 CrashLoopBackOff 147 (3m51s ago) 12h 10.0.0.6 mcwk8s-node2
kube-flannel-ds-hpgkz 1/1 Running 0 5d 10.0.0.4 mcwk8s-master
kube-flannel-ds-nnjvj 0/1 CrashLoopBackOff 185 (3m38s ago) 5d 10.0.0.5 mcwk8s-node1
kube-proxy-92g5c 1/1 Running 0 12h 10.0.0.6 mcwk8s-node2
kube-proxy-kk22j 1/1 Running 0 5d 172.16.0.5 mcwk8s-node1
kube-proxy-xjjgf 1/1 Running 0 5d 10.0.0.4 mcwk8s-master
kube-scheduler-mcwk8s-master 1/1 Running 5 (82m ago) 5d 10.0.0.4 mcwk8s-master
[machangwei@mcwk8s-master ~]$

回到顶部## 学习kube-flannel-ds

截取部分:https://blog.csdn.net/machangwei-8/p/15759077.html#_label7

apiVersion: apps/v1
kind: DaemonSet #语法结构和Deployment几乎往前一样,只是将kind设为DaemonSet
metadata:name: kube-flannel-dsnamespace: kube-systemlabels:tier: nodeapp: flannel
spec:selector:matchLabels:app: flanneltemplate:metadata:labels:tier: nodeapp: flannelspec:hostNetwork: true #指定Pod直接使用的是Node网络,相当于docker run --network=host。#考虑到flannel需要为集群提供网络连接,这个要求是合理的initContainers:#定义了运行flannel服务的两个容器- name: install-cni-pluginimage: rancher/mirrored-flannelcni-flannel-cni-plugin:v1.0.0command:containers: #定义了运行flannel服务的两个容器- name: kube-flannelimage: quay.io/coreos/flannel:v0.15.1command:- /opt/bin/flanneldargs:- --ip-masq- --kube-subnet-mgr

回到顶部## 学习kube-proxy,查看daemonset配置

[machangwei@mcwk8s-master ~]$ kubectl edit daemonset kube-proxy --namespace=kube-system# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: apps/v1
kind: DaemonSet #指定资源类型
metadata:annotations:deprecated.daemonset.template.generation: "1"creationTimestamp: "2022-01-12T15:15:18Z"generation: 1labels:k8s-app: kube-proxyname: kube-proxynamespace: kube-systemresourceVersion: "18274"uid: 04cfea8d-94b3-4963-b8d2-b10a7b6a46b0
spec:revisionHistoryLimit: 10selector:matchLabels:k8s-app: kube-proxytemplate:metadata:creationTimestamp: nulllabels:k8s-app: kube-proxyspec:containers:- command:- /usr/local/bin/kube-proxy
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: apps/v1
kind: DaemonSet #指定资源类型
metadata:annotations:deprecated.daemonset.template.generation: "1"creationTimestamp: "2022-01-12T15:15:18Z"generation: 1labels:k8s-app: kube-proxyname: kube-proxynamespace: kube-systemresourceVersion: "18274"uid: 04cfea8d-94b3-4963-b8d2-b10a7b6a46b0
spec:revisionHistoryLimit: 10selector:matchLabels:k8s-app: kube-proxytemplate:metadata:creationTimestamp: nulllabels:k8s-app: kube-proxyspec:containers: #定义kube-proxy的容器- command:- /usr/local/bin/kube-proxy- --config=/var/lib/kube-proxy/config.conf- --hostname-override=$(NODE\_NAME)env:- name: NODE\_NAMEvalueFrom:fieldRef:apiVersion: v1fieldPath: spec.nodeNameimage: registry.aliyuncs.com/google\_containers/kube-proxy:v1.23.1imagePullPolicy: IfNotPresentname: kube-proxyresources: {}securityContext:privileged: trueterminationMessagePath: /dev/termination-logterminationMessagePolicy: FilevolumeMounts:- mountPath: /var/lib/kube-proxyname: kube-proxy- mountPath: /run/xtables.lockname: xtables-lock- mountPath: /lib/modulesname: lib-modulesreadOnly: truednsPolicy: ClusterFirsthostNetwork: truenodeSelector:kubernetes.io/os: linuxpriorityClassName: system-node-criticalrestartPolicy: AlwaysschedulerName: default-schedulersecurityContext: {}serviceAccount: kube-proxyserviceAccountName: kube-proxyterminationGracePeriodSeconds: 30tolerations:- operator: Existsvolumes:- configMap:defaultMode: 420name: kube-proxyname: kube-proxy- hostPath:path: /run/xtables.locktype: FileOrCreatename: xtables-lock- hostPath:path: /lib/modulestype: ""name: lib-modulesupdateStrategy:rollingUpdate:maxSurge: 0maxUnavailable: 1type: RollingUpdate
status: #当前DamonSet的运行状态,这个部分是kubectl edit 特有的。其实kubernetes集群中每个当前运行的资源都currentNumberScheduled: 3 #可以通过kubectl edit 查看器配置和运行状态, desiredNumberScheduled: 3 #比如: kubectl edit deployment mcwnginx-deploymentnumberAvailable: 3numberMisscheduled: 0numberReady: 3observedGeneration: 1updatedNumberScheduled: 3[machangwei@mcwk8s-master ~]$ kubectl edit daemonset kube-proxy --namespace=kube-system #跟vim一样,q退出,如果修改了那么应该是wq吧
Edit cancelled, no changes made.

回到顶部## 运行自己的DaemonSet失败

有时间再看这个失败问题,如果哪位大佬知道,指点下也好

[machangwei@mcwk8s-master ~]$ vim mcwJiankong.yml
[machangwei@mcwk8s-master ~]$ cat mcw
cat: mcw: No such file or directory
[machangwei@mcwk8s-master ~]$ cat mcw
mcwJiankong.yml mcwNginx.yml
[machangwei@mcwk8s-master ~]$ cat mcwJiankong.yml
apiVersion: apps/v1
kind: DaemonSet
metadata:name: mcw-prometheus-node-daemonset
spec:replicas: 3selector:matchLabels:app: mcw\_prometheustemplate:metadata:labels:app: mcw\_prometheusspec:hostNetwork: truecontainers:- name: mcw-pr-nodeimage: prom/node-exporterimagePullPolicy: IfNotPresentcommand:- /bin/node\_exporter- --pathprocfs- /host/proc- --path.sysfs- /host/sys- --collector.filesystem.ignored-mount-points- ^/(sys|proc|dev|host|etc)($|/)volumeMounts:- name: procmountPath: /host/proc- name: sysmountPath: /host/sys- name: rootmountPath: /rootfsvolumes:- name: prochostPath:path: /proc- name: syshostPath:path: /sys- name: roothostPath:path: /
[machangwei@mcwk8s-master ~]$ kubectl apply -f mcwJiankong.yml #daemonset不能指定副本数量,好像每个节点都会运行,这里可能没包括主节点
error: error validating "mcwJiankong.yml": error validating data: ValidationError(DaemonSet.spec): unknown field "replicas" in io.k8s.api.apps.v1.DaemonSetSpec; if you choose to ignore these errors, turn validation off with --validate=false
[machangwei@mcwk8s-master ~]$
[machangwei@mcwk8s-master ~]$ vim mcwJiankong.yml
[machangwei@mcwk8s-master ~]$ cat mcwJiankong.yml #去掉副本数
apiVersion: apps/v1
kind: DaemonSet
metadata:name: mcw-prometheus-node-daemonset
spec:selector:matchLabels:app: mcw\_prometheustemplate:metadata:labels:app: mcw\_prometheusspec:hostNetwork: truecontainers:- name: mcw-pr-nodeimage: prom/node-exporterimagePullPolicy: IfNotPresentcommand:- /bin/node\_exporter- --pathprocfs- /host/proc- --path.sysfs- /host/sys- --collector.filesystem.ignored-mount-points- ^/(sys|proc|dev|host|etc)($|/)volumeMounts:- name: procmountPath: /host/proc- name: sysmountPath: /host/sys- name: rootmountPath: /rootfsvolumes:- name: prochostPath:path: /proc- name: syshostPath:path: /sys- name: roothostPath:path: /
[machangwei@mcwk8s-master ~]$
[machangwei@mcwk8s-master ~]$
[machangwei@mcwk8s-master ~]$ kubectl apply -f mcwJiankong.yml
daemonset.apps/mcw-prometheus-node-daemonset created
[machangwei@mcwk8s-master ~]$ kubectl get daemonset #查看daemonset
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
mcw-prometheus-node-daemonset   2         2         0       2            0            19s
[machangwei@mcwk8s-master ~]$ kubectl get pod -o wide #查看pod,结果未能成功运行。不清楚原因,有时间再看这个问题
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
mcw-prometheus-node-daemonset-cv8k2 0/1 CrashLoopBackOff 2 (17s ago) 60s 10.0.0.5 mcwk8s-node1
mcw-prometheus-node-daemonset-z2vvc 0/1 Error 2 (30s ago) 60s 10.0.0.6 mcwk8s-node2
[machangwei@mcwk8s-master ~]$ kubectl describe pod mcw-prometheus-node-daemonset-cv8k2
Name: mcw-prometheus-node-daemonset-cv8k2
Namespace: default
Priority: 0
Node: mcwk8s-node1/10.0.0.5
Start Time: Tue, 18 Jan 2022 00:34:32 +0800
Labels: app=mcw\_prometheuscontroller-revision-hash=7b99d77578pod-template-generation=1
Annotations:
Status: Running
IP: 10.0.0.5
IPs:IP: 10.0.0.5
Controlled By: DaemonSet/mcw-prometheus-node-daemonset
Containers:mcw-pr-node:Container ID: docker://7ff049b0c303ebb997c4794c9ffadbe7520f8cfdba71caec3b6b32c193ea1369Image: prom/node-exporterImage ID: docker-pullable://prom/node-exporter@sha256:f2269e73124dd0f60a7d19a2ce1264d33d08a985aed0ee6b0b89d0be470592cdPort: Host Port: Command:/bin/node\_exporter--pathprocfs/host/proc--path.sysfs/host/sys--collector.filesystem.ignored-mount-points^/(sys|proc|dev|host|etc)($|/)State: WaitingReason: CrashLoopBackOffLast State: TerminatedReason: ErrorExit Code: 1Started: Tue, 18 Jan 2022 00:36:24 +0800Finished: Tue, 18 Jan 2022 00:36:24 +0800Ready: FalseRestart Count: 4Environment: Mounts:/host/proc from proc (rw)/host/sys from sys (rw)/rootfs from root (rw)/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-w9bkl (ro)
Conditions:Type StatusInitialized True Ready False ContainersReady False PodScheduled True
Volumes:proc:Type: HostPath (bare host directory volume)Path: /procHostPathType: sys:Type: HostPath (bare host directory volume)Path: /sysHostPathType: root:Type: HostPath (bare host directory volume)Path: /HostPathType: kube-api-access-w9bkl:Type: Projected (a volume that contains injected data from multiple sources)TokenExpirationSeconds: 3607ConfigMapName: kube-root-ca.crtConfigMapOptional: DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/disk-pressure:NoSchedule op=Existsnode.kubernetes.io/memory-pressure:NoSchedule op=Existsnode.kubernetes.io/network-unavailable:NoSchedule op=Existsnode.kubernetes.io/not-ready:NoExecute op=Existsnode.kubernetes.io/pid-pressure:NoSchedule op=Existsnode.kubernetes.io/unreachable:NoExecute op=Existsnode.kubernetes.io/unschedulable:NoSchedule op=Exists
Events:Type Reason Age From Message---- ------ ---- ---- -------Normal Scheduled 2m36s default-scheduler Successfully assigned default/mcw-prometheus-node-daemonset-cv8k2 to mcwk8s-node1Normal Pulling 2m36s kubelet Pulling image "prom/node-exporter"Normal Pulled 2m9s kubelet Successfully pulled image "prom/node-exporter" in 27.526626918sNormal Created 45s (x5 over 2m9s) kubelet Created container mcw-pr-nodeNormal Started 45s (x5 over 2m8s) kubelet Started container mcw-pr-nodeNormal Pulled 45s (x4 over 2m8s) kubelet Container image "prom/node-exporter" already present on machineWarning BackOff 31s (x9 over 2m7s) kubelet Back-off restarting failed container
[machangwei@mcwk8s-master ~]$

kubernetes运行应用2之DaemonSet详解相关推荐

  1. Kubernetes K8S之资源控制器Daemonset详解

    Kubernetes的资源控制器Daemonset详解与示例 主机配置规划 服务器名称(hostname) 系统版本 配置 内网IP 外网IP(模拟) k8s-master CentOS7.7 2C/ ...

  2. 基于Kubernetes构建Docker集群管理详解

    from: 基于Kubernetes构建Docker集群管理详解 Kubernetes是Google开源的容器集群管理系统,基于Docker构建一个容器的调度服务,提供资源调度.均衡容灾.服务注册.动 ...

  3. python硬件交互_对Python的交互模式和直接运行.py文件的区别详解

    对Python的交互模式和直接运行.py文件的区别详解 看到类似C:\>是在Windows提供的命令行模式,看到>>>是在Python交互式环境下. 在命令行模式下,可以执行p ...

  4. 容器编排技术 -- Kubernetes kubectl create secret docker-registry 命令详解

    容器编排技术 -- Kubernetes kubectl create secret docker-registry 命令详解 1 kubectl create secret docker-regis ...

  5. 容器编排技术 -- Kubernetes kubectl create secret generic 命令详解

    容器编排技术 -- Kubernetes kubectl create secret generic 命令详解 1 kubectl create secret generic 2 语法 3 示例 4  ...

  6. 容器编排技术 -- Kubernetes kubectl create secret tls 命令详解

    容器编排技术 -- Kubernetes kubectl create secret tls 命令详解 1 create secret tls 2 语法 3 示例 4 Flags create sec ...

  7. 容器编排技术 -- Kubernetes kubectl create service nodeport 命令详解

    容器编排技术 -- Kubernetes kubectl create service nodeport 命令详解 1 kubectl create service nodeport 2 语法 3 示 ...

  8. 容器编排技术 -- Kubernetes kubectl create service loadbalancer 命令详解

    容器编排技术 -- Kubernetes kubectl create service loadbalancer 命令详解 1 kubectl create service loadbalancer ...

  9. 容器编排技术 -- Kubernetes kubectl create service externalname 命令详解

    容器编排技术 -- Kubernetes kubectl create service externalname 命令详解 1 kubectl create service externalname ...

最新文章

  1. Red5安装与入门 与FMS配置
  2. 最佳实践系列:前端代码标准和最佳实践
  3. 小车故障灯亮显示大全_史上最全汽车故障灯大全,留着一定有用!
  4. C语言数组查找(线性查找 折半查找)
  5. 高可用性HA及Cluster集群
  6. 登录或连接MYSLQ 提示 error 1045 access denied for user 'root@127.0.0.1' 错误
  7. Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
  8. oracle trap,配置SNMP trap
  9. 将人民币大写金额格式转为数字金额格式C#代码
  10. 【ThreeJS基础教程-高级几何体篇】2.5 加载GLTF/GLB格式文件,Draco压缩文件的获取与加载
  11. testerhome学习笔记2_Bash基础
  12. Python实现SMMS图床
  13. 全选反选的逻辑和代码
  14. 如何用潜类别混合效应模型(Latent Class Mixed Model ,LCMM)分析老年痴呆年龄数据
  15. 现代人遇到鸿蒙碎片,原来我是盖世奶爸-第126章 虚空之门是鸿蒙鼎碎片?
  16. addons软件下载_addons手机正版下载|
  17. pyspider显示web太小
  18. DNS劫持是什么意思?百度dns有什么坏处?DNS被劫持会造成哪些后果?
  19. Hibernate(四)一对多映射关系(set映射自定义对象)
  20. 为什么相同资源 IDM 感觉比迅雷快好多?

热门文章

  1. RPA在人力资源上的应用
  2. inotia4 android mod,Inotia4——武器隐藏属性【完整篇】
  3. 停车场微信支付系统 本地服务器,一种基于微信支付的停车自动收费系统
  4. 你只知道@Value?设置server.port就能定义端口号是如何实现的?springboot读取配置文件的多种方式以及源码解析
  5. adobe证书。安装的时候有公司 作者提示
  6. Ubuntu18.04安装Cmake(最新最详细亲测)
  7. 统计分析/机器学习吐血整理最强指南(第二版)
  8. uni-app接入阿里图标使用以及图标旋转
  9. 基于51单片机的智能饮水机烧水控制系统proteus仿真原理图PCB
  10. 榕树贷款分布式共识算法分为CFT与BFT(榕树贷款)