本文介绍了库伯内斯·库贝-主控人兼经理。我怎样才能贴上旗帜呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

the documentation中,我发现应该在kube-controller-manager上应用以下标志来解决我的问题:

--horizontal-pod-autoscaler-use-rest-clients=1m0s
但是,我如何将此标志应用于kube-controller-manager?我不明白,因为它不是基于YAML的设置,而且我的本地计算机上只有kubectl&;ocCLI工具。

推荐答案

kube-controller-manager在您的K8S控制平面中运行。因此,您必须在运行控制平面的服务器上添加该标志。通常,由于这是推荐的仲裁,这是服务器(一个是主服务器)3或5的偶数。(Example using kubeadm)。

因此,kube-controller-manager配置通常位于您的主控件中的/etc/kubernetes/manifests下。文件名通常为kube-controller-manager.yaml,内容可以更改为以下内容:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    component: kube-controller-manager
    tier: control-plane
  name: kube-controller-manager
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-controller-manager
    - --authentication-kubeconfig=/etc/kubernetes/controller-manager.conf
    - --authorization-kubeconfig=/etc/kubernetes/controller-manager.conf
    - --bind-address=127.0.0.1
    - --client-ca-file=/var/lib/minikube/certs/ca.crt
    - --cluster-signing-cert-file=/var/lib/minikube/certs/ca.crt
    - --cluster-signing-key-file=/var/lib/minikube/certs/ca.key
    - --controllers=*,bootstrapsigner,tokencleaner
    - --kubeconfig=/etc/kubernetes/controller-manager.conf
    - --leader-elect=true
    - --requestheader-client-ca-file=/var/lib/minikube/certs/front-proxy-ca.crt
    - --root-ca-file=/var/lib/minikube/certs/ca.crt
    - --service-account-private-key-file=/var/lib/minikube/certs/sa.key
    - --use-service-account-credentials=true
    - --horizontal-pod-autoscaler-use-rest-clients=1m0s  <== add this line
    image: k8s.gcr.io/kube-controller-manager:v1.16.2
    imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 8
      httpGet:
        host: 127.0.0.1
        path: /healthz
        port: 10252
        scheme: HTTP
      initialDelaySeconds: 15
      timeoutSeconds: 15
    name: kube-controller-manager
    resources:
      requests:
        cpu: 200m
    volumeMounts:
    - mountPath: /etc/ssl/certs
      name: ca-certs
      readOnly: true
    - mountPath: /var/lib/minikube/certs
      name: k8s-certs
      readOnly: true
    - mountPath: /etc/kubernetes/controller-manager.conf
      name: kubeconfig
      readOnly: true
    - mountPath: /usr/share/ca-certificates
      name: usr-share-ca-certificates
      readOnly: true
  hostNetwork: true
  priorityClassName: system-cluster-critical
  volumes:
  - hostPath:
      path: /etc/ssl/certs
      type: DirectoryOrCreate
    name: ca-certs
  - hostPath:
      path: /var/lib/minikube/certs
      type: DirectoryOrCreate
    name: k8s-certs
  - hostPath:
      path: /etc/kubernetes/controller-manager.conf
      type: FileOrCreate
    name: kubeconfig
  - hostPath:
      path: /usr/share/ca-certificates
      type: DirectoryOrCreate
    name: usr-share-ca-certificates
status: {}

然后您需要重新启动Kube-Controller-Manager。

根据您在主机中运行的内容,这可能会有所不同。如果执行类似docker的操作,您可以sudo systemctl restart docker,或者如果您使用的是tainerd而不是dockersystemctl restart containerd

,则可能需要重新启动tainerd

或者,如果您只想启动kube-controller-manager,您可以执行docker restart kube-controller-mamnagercrictl stop kube-controller-manager; crictl start kube-controller-manager

这篇关于库伯内斯·库贝-主控人兼经理。我怎样才能贴上旗帜呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-20 07:32