IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> kubectl describe pod 里边没有看到events问题解决 -> 正文阅读

[系统运维]kubectl describe pod 里边没有看到events问题解决

新搭建的k8s集群,创建pod的时候发现使用kubectl describe pod命令查看pod状态,发现events为<none>。

kubectl describe pod data-service-589c97fc76-sjtkc -n common
Name:         data-service-589c97fc76-sjtkc
Namespace:    common
Priority:     0
Node:         debian-3/192.168.1.197
Start Time:   Sat, 25 Dec 2021 23:32:46 +0800
Labels:       app=data-service
              pod-template-hash=589c97fc76
Annotations:  <none>
Status:       Running
IP:           10.244.2.7
IPs:
  IP:           10.244.2.7
Controlled By:  ReplicaSet/data-service-589c97fc76
Containers:
  data-service:
    Container ID:   docker://1cf05406a64148328035fcd5e72d6a3140ca8f3f3a1e2e79098a78582a3864a0
    Image:          192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE
    Image ID:       docker-pullable://192.168.1.196:80/newpathfly/data-service@sha256:1927a9ff0b2575f322e7d1ddf0e54ec4e2651d2dee70bb81c64374d18e1dc6e5
    Port:           9000/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Sat, 25 Dec 2021 23:32:47 +0800
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     500m
      memory:  1Gi
    Requests:
      cpu:     500m
      memory:  1Gi
    Environment:
      JAVA_OPTS:  -server -Xms256m -Xmx512m -XX:+PrintGC -XX:+PrintHeapAtGC -Xloggc:gc.log
    Mounts:
      /app/conf/application.conf from config-volume (rw,path="application.conf")
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-9l65j (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      data-service
    Optional:  false
  kube-api-access-9l65j:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Guaranteed
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:                      <none>

这时不要慌,用kubectl get events -A 查看一下:

kubectl get events -A
Error from server (Forbidden): events is forbidden: User "marlin" cannot list resource "events" in API group "" at the cluster scope

原来是没有查看events的权限,只需要把对应的role.yaml里增加events权限即可。

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: cluster-reader
rules:
- apiGroups:
  - ""
  - "batch"
  - "apps"
  resources:
  - pods
  - nodes
  - services
  - cronjobs
  - jobs
  - endpoints
  - deployments
  - namespaces
  - pods/log
  - pods/exec
  - persistentvolumes
  - configmaps
  - secrets
  - persistentvolumeclaims
  - events
  verbs:
  - get
  - list
  - watch
  - delete
  - create

apply之后,可以正常看到pod的events信息:

kubectl get events -A
NAMESPACE   LAST SEEN   TYPE      REASON             OBJECT                               MESSAGE
common      6m27s       Normal    Killing            pod/data-service-589c97fc76-98k5g    Stopping container data-service
common      6m27s       Normal    Scheduled          pod/data-service-589c97fc76-9g57c    Successfully assigned common/data-service-589c97fc76-9g57c to debian-2
common      5m44s       Normal    Pulling            pod/data-service-589c97fc76-9g57c    Pulling image "192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE"
common      5m44s       Warning   Failed             pod/data-service-589c97fc76-9g57c    Failed to pull image "192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE": rpc error: code = Unknown desc = Error response from daemon: Get "http://192.168.1.196:80/v2/": dial tcp 192.168.1.196:80: connect: connection refused
common      5m44s       Warning   Failed             pod/data-service-589c97fc76-9g57c    Error: ErrImagePull
common      5m19s       Normal    BackOff            pod/data-service-589c97fc76-9g57c    Back-off pulling image "192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE"
common      5m19s       Warning   Failed             pod/data-service-589c97fc76-9g57c    Error: ImagePullBackOff
common      5m17s       Normal    Scheduled          pod/data-service-589c97fc76-sjtkc    Successfully assigned common/data-service-589c97fc76-sjtkc to debian-3
common      5m16s       Normal    Pulled             pod/data-service-589c97fc76-sjtkc    Container image "192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE" already present on machine
common      5m16s       Normal    Created            pod/data-service-589c97fc76-sjtkc    Created container data-service
common      5m16s       Normal    Started            pod/data-service-589c97fc76-sjtkc    Started container data-service
common      6m27s       Normal    SuccessfulCreate   replicaset/data-service-589c97fc76   Created pod: data-service-589c97fc76-9g57c
common      5m17s       Normal    SuccessfulCreate   replicaset/data-service-589c97fc76   Created pod: data-service-589c97fc76-sjtkc

Name:         data-service-589c97fc76-sjtkc
Namespace:    common
Priority:     0
Node:         debian-3/192.168.1.197
Start Time:   Sat, 25 Dec 2021 23:32:46 +0800
Labels:       app=data-service
              pod-template-hash=589c97fc76
Annotations:  <none>
Status:       Running
IP:           10.244.2.7
IPs:
  IP:           10.244.2.7
Controlled By:  ReplicaSet/data-service-589c97fc76
Containers:
  data-service:
    Container ID:   docker://1cf05406a64148328035fcd5e72d6a3140ca8f3f3a1e2e79098a78582a3864a0
    Image:          192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE
    Image ID:       docker-pullable://192.168.1.196:80/newpathfly/data-service@sha256:1927a9ff0b2575f322e7d1ddf0e54ec4e2651d2dee70bb81c64374d18e1dc6e5
    Port:           9000/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Sat, 25 Dec 2021 23:32:47 +0800
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     500m
      memory:  1Gi
    Requests:
      cpu:     500m
      memory:  1Gi
    Environment:
      JAVA_OPTS:  -server -Xms256m -Xmx512m -XX:+PrintGC -XX:+PrintHeapAtGC -Xloggc:gc.log
    Mounts:
      /app/conf/application.conf from config-volume (rw,path="application.conf")
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-9l65j (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  config-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      data-service
    Optional:  false
  kube-api-access-9l65j:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   Guaranteed
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age    From               Message
  ----    ------     ----   ----               -------
  Normal  Scheduled  6m19s  default-scheduler  Successfully assigned common/data-service-589c97fc76-sjtkc to debian-3
  Normal  Pulled     6m19s  kubelet            Container image "192.168.1.196:80/newpathfly/data-service:0.7.1-RELEASE" already present on machine
  Normal  Created    6m19s  kubelet            Created container data-service
  Normal  Started    6m19s  kubelet            Started container data-service

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2021-12-26 22:38:51  更:2021-12-26 22:39:25 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/16 6:24:45-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码