Kubernetes(K8S) 安装 Metrics-Server kubectl top (metrics-server) node NotFound

kubernetes,k8s,安装,metrics,server,kubectl,top,node,notfound · 浏览次数 : 281

小编点评

**方法一:使用 `kubectl top` 命令** ``` kubectl top nodes -n kube-systemspec ``` **方法二:使用 `kubectl describe nodes | grep -i "metrics-server"`** ``` kubectl describe nodes | grep -i "metrics-server" ``` **方法三:使用 `kubectl get pods -n kube-systemspec | grep -i "metrics-server"`** ``` kubectl get pods -n kube-systemspec | grep -i "metrics-server" ``` **方法四:使用 `kubectl get nodes | grep -i "metrics-server"`** ``` kubectl get nodes | grep -i "metrics-server" ``` **方法五:使用 `kubectl get services -n kube-systemspec | grep -i "metrics-server"`** ``` kubectl get services -n kube-systemspec | grep -i "metrics-server" ```

正文

kubectl top (metrics-server) node NotFound

components.yaml
网上的各种方法都有问题,找到了一个完整版的 yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    k8s-app: metrics-server
    rbac.authorization.k8s.io/aggregate-to-admin: "true"
    rbac.authorization.k8s.io/aggregate-to-edit: "true"
    rbac.authorization.k8s.io/aggregate-to-view: "true"
  name: system:aggregated-metrics-reader
rules:
  - apiGroups:
      - metrics.k8s.io
    resources:
      - pods
      - nodes
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    k8s-app: metrics-server
  name: system:metrics-server
rules:
  - apiGroups:
      - ""
    resources:
      - pods
      - nodes
      - nodes/stats
      - namespaces
      - configmaps
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server-auth-reader
  namespace: kube-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: extension-apiserver-authentication-reader
subjects:
  - kind: ServiceAccount
    name: metrics-server
    namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server:system:auth-delegator
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:auth-delegator
  # name: system:metrics-server
subjects:
  - kind: ServiceAccount
    name: metrics-server
    namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    k8s-app: metrics-server
  name: system:metrics-server
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:metrics-server
subjects:
  - kind: ServiceAccount
    name: metrics-server
    namespace: kube-system
---
apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
spec:
  ports:
    - name: https
      port: 443
      protocol: TCP
      targetPort: https
  selector:
    k8s-app: metrics-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: metrics-server
  strategy:
    rollingUpdate:
      maxUnavailable: 0
  template:
    metadata:
      labels:
        k8s-app: metrics-server
    spec:
      containers:
        - args:
            - --cert-dir=/tmp
            - --secure-port=4443
            - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
            - --kubelet-use-node-status-port
            - --kubelet-insecure-tls
          # image: k8s.gcr.io/metrics-server/metrics-server:v0.4.1
          image: phperall/metrics-server:v0.4.1
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /livez
              port: https
              scheme: HTTPS
            periodSeconds: 10
          name: metrics-server
          ports:
            - containerPort: 4443
              name: https
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /readyz
              port: https
              scheme: HTTPS
            periodSeconds: 10
          securityContext:
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
          volumeMounts:
            - mountPath: /tmp
              name: tmp-dir
      nodeSelector:
        kubernetes.io/os: linux
      priorityClassName: system-cluster-critical
      serviceAccountName: metrics-server
      volumes:
        - emptyDir: {}
          name: tmp-dir
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
  labels:
    k8s-app: metrics-server
  name: v1beta1.metrics.k8s.io
spec:
  group: metrics.k8s.io
  groupPriorityMinimum: 100
  insecureSkipTLSVerify: true
  service:
    name: metrics-server
    namespace: kube-system
  version: v1beta1
  versionPriority: 100
[root@k8smaster ~]# vi components.yaml
[root@k8smaster ~]# kubectl apply -f components.yaml

与Kubernetes(K8S) 安装 Metrics-Server kubectl top (metrics-server) node NotFound相似的内容:

Kubernetes(K8S) 安装 Metrics-Server kubectl top (metrics-server) node NotFound

kubectl top (metrics-server) node NotFound components.yaml 网上的各种方法都有问题,找到了一个完整版的 yaml apiVersion: v1 kind: ServiceAccount metadata: labels: k8s-app: m

Kubernetes(K8S) 安装Nacos,报 No DataSource set

原因,数据库为 MySQL 5.7 需要在yaml加上参数 mysql.db.param: "characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&serverTim

Kubernetes(K8S) kubesphere 介绍

使用 Kubeadm 部署 Kubernetes(K8S) 安装--附K8S架构图 Kubernetes(K8S) kubesphere 安装 官网地址:https://kubesphere.com.cn/ KubeSphere 是个全栈的Kubernetes容器云PaaS解决方案 KubeSphe

使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(NFS网络存储)

使用 Kubeadm 部署 Kubernetes(K8S) 安装 使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- Ingress-Ngnix Volume 是 Pod 中能够被多个容器访问的共享目录。 Kubernetes 的 Volume 定义在 Pod 上,它被一个 Po

使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(PV&PVC)

使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- Ingress-Ngnix 使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(NFS网络存储) NFS 存在一个弊端,需要知道NFS服务器的地址,配在 yaml 中 PV:持久化存储,对存储资源

使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- Ingress-Ngnix

前置条件:使用 Kubeadm 部署 Kubernetes(K8S) 安装 安装ingress-nginx组件(在master节点执行) 通过 ip+port 号进行访问,使用 Service 里的 NodePort 实现,把端口对外暴露 缺陷:一个端口只能使用一次,一个端口对应一个应用,实际使用中

Kubernetes(K8S) helm 安装

Helm 是一个 Kubernetes 的包管理工具, 就像 Linux 下的包管理器, 如 yum/apt 等, 可以很方便的将之前打包好的 yaml 文件部署到 kubernetes 上。 Helm 有 3 个重要概念: helm: 一个命令行客户端工具, 主要用于 Kubernetes 应用

Kubernetes(K8S) kubesphere 安装

安装KubeSphere最好的方法就是参考官方文档,而且官方文档是中文的。 官网地址:https://kubesphere.com.cn/ https://github.com/kubesphere/kubesphere/blob/master/README_zh.md Kubernetes(K8S

二进制安装Kubernetes(k8s)v1.30.1

二进制安装Kubernetes(k8s)v1.30.1 https://github.com/cby-chen/Kubernetes 开源不易,帮忙点个star,谢谢了 介绍 kubernetes(k8s)二进制高可用安装部署,支持IPv4+IPv6双栈。 我使用IPV6的目的是在公网进行访问,所以

k8s安装prometheus

##### 安装 在目标集群上,执行如下命令: ```shell kubectl apply -f https://github.com/512team/dhorse/raw/main/conf/kubernetes-prometheus.yml ``` ##### 使用 1.在浏览器访问地址:ht