热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

实战生产环境:最新K8sAnnotations详解

本篇文章,所使用的任何镜像我都会发一个网盘链接,供大家下载学习!yaml请到我的github上下载学习!github:https:github.comheyangguang有任何问

本篇文章,所使用的任何镜像我都会发一个网盘链接,供大家下载学习!

yaml 请到我的github上下载学习!

github:https://github.com/heyangguang

有任何问题可以直接联系我的Email:heyangev@cn.ibm.com

Annotations官网

https://kubernetes.io/docs/co…

Annotations介绍

顾名思义,就是注释的意思。有两个功能:

  • 注释性信息,不影响调度
  • 工具和库等客户端可以检索Annotation数据
查看Annotations

[root@master01 ~]# kubectl describe nodes node01
Name: node01
Roles: work
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/arch=amd64
kubernetes.io/hostname=node01
kubernetes.io/os=linux
node-role.kubernetes.io/work=
Annotations: kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
node.alpha.kubernetes.io/ttl: 0
projectcalico.org/IPv4Address: 172.20.102.221/20
projectcalico.org/IPv4IPIPTunnelAddr: 192.168.196.128
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Sat, 10 Aug 2019 12:42:08 +0800
Taints:
Unschedulable: false
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
NetworkUnavailable False Sat, 10 Aug 2019 12:42:54 +0800 Sat, 10 Aug 2019 12:42:54 +0800 CalicoIsUp Calico is running on this node
MemoryPressure False Sun, 11 Aug 2019 00:01:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Sun, 11 Aug 2019 00:01:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False Sun, 11 Aug 2019 00:01:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasSufficientPID kubelet has sufficient PID available
Ready True Sun, 11 Aug 2019 00:01:21 +0800 Sat, 10 Aug 2019 12:42:28 +0800 KubeletReady kubelet is posting ready status
Addresses:
InternalIP: 172.20.102.221
Hostname: node01
Capacity:
cpu: 2
ephemeral-storage: 41147472Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 8009180Ki
pods: 110
Allocatable:
cpu: 2
ephemeral-storage: 37921510133
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 7906780Ki
pods: 110
System Info:
Machine ID: 20190711105006363114529432776998
System UUID: 7ABFD479-B967-4A73-9D8A-5E0993B76A2D
Boot ID: f61e9e10-1864-4610-a98c-c8c9924bd8e9
Kernel Version: 3.10.0-957.21.3.el7.x86_64
OS Image: CentOS Linux 7 (Core)
Operating System: linux
Architecture: amd64
Container Runtime Version: docker://18.6.2
Kubelet Version: v1.15.2
Kube-Proxy Version: v1.15.2
PodCIDR: 192.168.1.0/24
Non-terminated Pods: (3 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE
--------- ---- ------------ ---------- --------------- ------------- ---
default label-demo 0 (0%) 0 (0%) 0 (0%) 0 (0%) 16m
kube-system calico-node-nsjfq 250m (12%) 0 (0%) 0 (0%) 0 (0%) 11h
kube-system kube-proxy-dd78n 0 (0%) 0 (0%) 0 (0%) 0 (0%) 11h
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 250m (12%) 0 (0%)
memory 0 (0%) 0 (0%)
ephemeral-storage 0 (0%) 0 (0%)
Events:
创建Annotations

1、命令行创建

[root@master01 ~]# kubectl annotate nodes node01 test_people=heyang
node/node01 annotated
[root@master01 ~]# kubectl describe nodes node01
Name: node01
Roles: work
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/arch=amd64
kubernetes.io/hostname=node01
kubernetes.io/os=linux
node-role.kubernetes.io/work=
Annotations: kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
node.alpha.kubernetes.io/ttl: 0
projectcalico.org/IPv4Address: 172.20.102.221/20
projectcalico.org/IPv4IPIPTunnelAddr: 192.168.196.128
test_people: heyang
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Sat, 10 Aug 2019 12:42:08 +0800
Taints:
Unschedulable: false
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
NetworkUnavailable False Sat, 10 Aug 2019 12:42:54 +0800 Sat, 10 Aug 2019 12:42:54 +0800 CalicoIsUp Calico is running on this node
MemoryPressure False Sun, 11 Aug 2019 00:03:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Sun, 11 Aug 2019 00:03:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False Sun, 11 Aug 2019 00:03:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasSufficientPID kubelet has sufficient PID available
Ready True Sun, 11 Aug 2019 00:03:21 +0800 Sat, 10 Aug 2019 12:42:28 +0800 KubeletReady kubelet is posting ready status
Addresses:
InternalIP: 172.20.102.221
Hostname: node01
Capacity:
cpu: 2
ephemeral-storage: 41147472Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 8009180Ki
pods: 110
Allocatable:
cpu: 2
ephemeral-storage: 37921510133
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 7906780Ki
pods: 110
System Info:
Machine ID: 20190711105006363114529432776998
System UUID: 7ABFD479-B967-4A73-9D8A-5E0993B76A2D
Boot ID: f61e9e10-1864-4610-a98c-c8c9924bd8e9
Kernel Version: 3.10.0-957.21.3.el7.x86_64
OS Image: CentOS Linux 7 (Core)
Operating System: linux
Architecture: amd64
Container Runtime Version: docker://18.6.2
Kubelet Version: v1.15.2
Kube-Proxy Version: v1.15.2
PodCIDR: 192.168.1.0/24
Non-terminated Pods: (3 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE
--------- ---- ------------ ---------- --------------- ------------- ---
default label-demo 0 (0%) 0 (0%) 0 (0%) 0 (0%) 19m
kube-system calico-node-nsjfq 250m (12%) 0 (0%) 0 (0%) 0 (0%) 11h
kube-system kube-proxy-dd78n 0 (0%) 0 (0%) 0 (0%) 0 (0%) 11h
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 250m (12%) 0 (0%)
memory 0 (0%) 0 (0%)
ephemeral-storage 0 (0%) 0 (0%)
Events:

2、yaml创建

[root@master01 ~]# touch pod-annotations.yaml
[root@master01 ~]# vim pod-annotations.yaml
[root@master01 ~]# cat pod-annotations.yaml
apiVersion: v1
kind: Pod
metadata:
name: annotations-demo
annotations:
imageregistry: "https://hub.docker.com/"
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
[root@master01 ~]# kubectl apply -f pod-annotations.yaml
pod/annotations-demo created
[root@master01 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
annotations-demo 0/1 ContainerCreating 0 7s
label-demo 1/1 Running 0 21m
[root@master01 ~]# kubectl describe pods annotations-demo
Name: annotations-demo
Namespace: default
Priority: 0
Node: node02/172.20.102.220
Start Time: Sun, 11 Aug 2019 00:05:46 +0800
Labels:
Annotations: cni.projectcalico.org/podIP: 192.168.140.65/32
imageregistry: https://hub.docker.com/
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{"imageregistry":"https://hub.docker.com/"},"name":"annotations-demo","namespace...
Status: Running
IP: 192.168.140.65
Containers:
nginx:
Container ID: docker://8fbbd1b6a180a55442301cc7113da92ddb74c34b13db670b27944137f13708fc
Image: nginx:1.7.9
Image ID: docker-pullable://nginx@sha256:e3456c851a152494c3e4ff5fcc26f240206abac0c9d794affb40e0714846c451
Port: 80/TCP
Host Port: 0/TCP
State: Running
Started: Sun, 11 Aug 2019 00:05:54 +0800
Ready: True
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-zh752 (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
default-token-zh752:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-zh752
Optional: false
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 19s default-scheduler Successfully assigned default/annotations-demo to node02
Normal Pulling 18s kubelet, node02 Pulling image "nginx:1.7.9"
Normal Pulled 11s kubelet, node02 Successfully pulled image "nginx:1.7.9"
Normal Created 11s kubelet, node02 Created container nginx
Normal Started 11s kubelet, node02 Started container nginx
删除Annotations

[root@master01 ~]# kubectl annotate nodes node01 test_people-
node/node01 annotated
[root@master01 ~]# kubectl describe nodes node01
Name: node01
Roles: work
Labels: beta.kubernetes.io/arch=amd64
beta.kubernetes.io/os=linux
kubernetes.io/arch=amd64
kubernetes.io/hostname=node01
kubernetes.io/os=linux
node-role.kubernetes.io/work=
Annotations: kubeadm.alpha.kubernetes.io/cri-socket: /var/run/dockershim.sock
node.alpha.kubernetes.io/ttl: 0
projectcalico.org/IPv4Address: 172.20.102.221/20
projectcalico.org/IPv4IPIPTunnelAddr: 192.168.196.128
volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp: Sat, 10 Aug 2019 12:42:08 +0800
Taints:
Unschedulable: false
Conditions:
Type Status LastHeartbeatTime LastTransitionTime Reason Message
---- ------ ----------------- ------------------ ------ -------
NetworkUnavailable False Sat, 10 Aug 2019 12:42:54 +0800 Sat, 10 Aug 2019 12:42:54 +0800 CalicoIsUp Calico is running on this node
MemoryPressure False Sun, 11 Aug 2019 00:07:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasSufficientMemory kubelet has sufficient memory available
DiskPressure False Sun, 11 Aug 2019 00:07:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasNoDiskPressure kubelet has no disk pressure
PIDPressure False Sun, 11 Aug 2019 00:07:21 +0800 Sat, 10 Aug 2019 12:42:08 +0800 KubeletHasSufficientPID kubelet has sufficient PID available
Ready True Sun, 11 Aug 2019 00:07:21 +0800 Sat, 10 Aug 2019 12:42:28 +0800 KubeletReady kubelet is posting ready status
Addresses:
InternalIP: 172.20.102.221
Hostname: node01
Capacity:
cpu: 2
ephemeral-storage: 41147472Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 8009180Ki
pods: 110
Allocatable:
cpu: 2
ephemeral-storage: 37921510133
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 7906780Ki
pods: 110
System Info:
Machine ID: 20190711105006363114529432776998
System UUID: 7ABFD479-B967-4A73-9D8A-5E0993B76A2D
Boot ID: f61e9e10-1864-4610-a98c-c8c9924bd8e9
Kernel Version: 3.10.0-957.21.3.el7.x86_64
OS Image: CentOS Linux 7 (Core)
Operating System: linux
Architecture: amd64
Container Runtime Version: docker://18.6.2
Kubelet Version: v1.15.2
Kube-Proxy Version: v1.15.2
PodCIDR: 192.168.1.0/24
Non-terminated Pods: (3 in total)
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits AGE
--------- ---- ------------ ---------- --------------- ------------- ---
default label-demo 0 (0%) 0 (0%) 0 (0%) 0 (0%) 23m
kube-system calico-node-nsjfq 250m (12%) 0 (0%) 0 (0%) 0 (0%) 11h
kube-system kube-proxy-dd78n 0 (0%) 0 (0%) 0 (0%) 0 (0%) 11h
Allocated resources:
(Total limits may be over 100 percent, i.e., overcommitted.)
Resource Requests Limits
-------- -------- ------
cpu 250m (12%) 0 (0%)
memory 0 (0%) 0 (0%)
ephemeral-storage 0 (0%) 0 (0%)
Events:

推荐阅读
  • Kubernetes(k8s)基础简介
    Kubernetes(k8s)基础简介目录一、Kubernetes概述(一)、Kubernetes是什么(二& ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • “自主设计与实施的故障注入微服务Sidecar,欢迎大佬批评指正!”
    “故障注入Sidecar“——为您的微服务注入故障以验证集群性能!由于导师和实验室师兄们的科研需要,本人专门以Sidecar的模式设计了一个用于错误注入的微服务模块。该模块可以与任 ... [详细]
  • 用Kubeadm安装K8s后,kubeflannelds一直CrashLoopBackOff
    2019独角兽企业重金招聘Python工程师标准如果使用Kubeadm安装K8s集群,在安装flannel网络插件后,发现pod:kube-fla ... [详细]
  • ScrollView嵌套Collectionview无痕衔接四向滚动,支持自定义TitleView
    本文介绍了如何实现ScrollView嵌套Collectionview无痕衔接四向滚动,并支持自定义TitleView。通过使用MainScrollView作为最底层,headView作为上部分,TitleView作为中间部分,Collectionview作为下面部分,实现了滚动效果。同时还介绍了使用runtime拦截_notifyDidScroll方法来实现滚动代理的方法。具体实现代码可以在github地址中找到。 ... [详细]
  • 像跟踪分布式服务调用那样跟踪Go函数调用链 | Gopher Daily (2020.12.07) ʕ◔ϖ◔ʔ
    每日一谚:“Acacheisjustamemoryleakyouhaven’tmetyet.”—Mr.RogersGo技术专栏“改善Go语⾔编程质量的50个有效实践” ... [详细]
  • 生产环境下JVM调优参数的设置实例
     正文前先来一波福利推荐: 福利一:百万年薪架构师视频,该视频可以学到很多东西,是本人花钱买的VIP课程,学习消化了一年,为了支持一下女朋友公众号也方便大家学习,共享给大家。福利二 ... [详细]
  • k8s进阶之搭建私有镜像仓库
    企业级私有镜像仓 ... [详细]
  • kubelet配置cni插件_Kubernetes新近kubectl及CNI漏洞修复,Rancher 2.2.1发布
    今天,Kubernetes发布了一系列补丁版本,修复新近发现的两个安全漏洞CVE-2019-1002101(kubectlcp命令安全漏洞)和CVE-2 ... [详细]
  • 本文|层面_Kubernetes概述
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了Kubernetes概述相关的知识,希望对你有一定的参考价值。前言本文搜集大量关于Kuber ... [详细]
  • minikube安装过程介绍minikubeMinikube是一个可以在本地轻松运行Kubernetes的工具。Minikube会在您的笔记本电脑中的虚拟机上运行一个单节点的Kub ... [详细]
  • 这篇文章主要讲解了“Kubernetes1.21.0如何部署管理界面Dashboard2”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢 ... [详细]
  • 使用工具   https:kubernetes.iodocssetupindependentcreate-cluster-kubeadmkubeadm简介:  kubeadm是ku ... [详细]
  • 目录实现效果:实现环境实现方法一:基本思路主要代码JavaScript代码总结方法二主要代码总结方法三基本思路主要代码JavaScriptHTML总结实 ... [详细]
  • 计算机存储系统的层次结构及其优势
    本文介绍了计算机存储系统的层次结构,包括高速缓存、主存储器和辅助存储器三个层次。通过分层存储数据可以提高程序的执行效率。计算机存储系统的层次结构将各种不同存储容量、存取速度和价格的存储器有机组合成整体,形成可寻址存储空间比主存储器空间大得多的存储整体。由于辅助存储器容量大、价格低,使得整体存储系统的平均价格降低。同时,高速缓存的存取速度可以和CPU的工作速度相匹配,进一步提高程序执行效率。 ... [详细]
author-avatar
红箭777_387
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有