【kubernetes/k8s概念】kubelet启动参数

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhonglinzhang/article/details/85279788

kubernetes version: v1.12.1

Desc

       The kubelet is the primary "node agent" that runs on each node. The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that describes a pod. The kubelet takes a set of PodSpecs that are provided through various mechanisms (primarily through the apiserver) and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn't manage containers which were not created by Kubernetes.

      Other than from an PodSpec from the apiserver, there are three ways that a container manifest can be provided to the Kubelet.

  • File: Path passed as a flag on the command line. Files under this path will be monitored periodically for updates. The monitoring period is 20s by default and is configurable via a flag.
  • HTTP endpoint: HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).
  • HTTP server: The kubelet can also listen for HTTP and respond to a simple API (underspec'd currently) to submit a new manifest.

启动命令行如下:

/opt/k8s/bin/kube-apiserver 
--admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota 
--advertise-address=10.10.15.71 
--bind-address=0.0.0.0 
--insecure-bind-address=127.0.0.1 
--authorization-mode=Node,RBAC 
--kubelet-https=true 
--token-auth-file=/etc/kubernetes/token.csv 
--service-cluster-ip-range=10.200.0.0/16 
--service-node-port-range=40000-52766 
--tls-cert-file=/etc/kubernetes/ssl/kubernetes.pem 
--tls-private-key-file=/etc/kubernetes/ssl/kubernetes-key.pem 
--client-ca-file=/etc/kubernetes/ssl/ca.pem 
--service-account-key-file=/etc/kubernetes/ssl/ca-key.pem 
--etcd-cafile=/etc/kubernetes/ssl/ca.pem 
--etcd-certfile=/etc/kubernetes/ssl/kubernetes.pem 
--etcd-keyfile=/etc/kubernetes/ssl/kubernetes-key.pem 
--etcd-servers=https://10.10.15.70:2379,https://10.10.15.71:2379,https://10.10.15.71:2379 -
-enable-swagger-ui=true 
--allow-privileged=true 
--apiserver-count=2 
--audit-log-maxage=30 
--audit-log-maxbackup=3 
--audit-log-maxsize=100 
--audit-log-path=/var/lib/audit.log 
--event-ttl=1h 
--logtostderr=true 
--v=2

Usage:
  kubelet [flags]

Kubelet启动参数详解

--allow-privileged=true 允许容器请求特权模式
--anonymous-auth=false

允许匿名请求到 kubelet 服务。未被另一个身份验证方法拒绝的请求被视为匿名请求。匿名请求包含系统的用户名: anonymous ,以及系统的组名: unauthenticated (默认 true )

--application-metrics-count-limit int 每一个容器store最大application metrics(default 100)
--authentication-token-webhook-cache-ttl duration

webhook 令牌身份验证缓存响应时间 (2m0s)

--authorization-mode string

授权模式(AlwaysAllow/ Webhook),Webhook 模式使用 SubjectAccessReview API 来确定授权

--authorization-webhook-cache-authorized-ttl duration

webhook 模式认证响应缓存时间(default 5m0s)

--authorization-webhook-cache-unauthorized-ttl duration webhook 模式认证未响应缓存时间(default 30s)
--authentication-token-webhook=true 使用 TokenReview API 来确定不记名令牌的身份验证
--bootstrap-kubeconfig string

kubelet 客户端证书的kubeconfig 文件路径,如果指定的文件不存在,将

使用 bootstrap kubeconfig 从 API 服务器请求一个客户端证书,成功后生成证书文件和密钥的 kubeconfig 将被写入指定的文件,客户端证书和密钥将被保存在 --cert-dir 指定的目录

--cadvisor-port=0 cAdvisor 端口(默认 4194)
 --cert-dir string 客户端证书和密钥将被保存在 --cert-dir 指定的目录
--cgroup-driver=cgroupfs 可选值有cgroupfs和systemd(默认cgroupfs)与docker驱动一致
--cgroup-root string

对于 pods 的可选root cgroup

--cgroups-per-qos

开启创建 QoS cgroup 层级,

true 意味着创建顶级 QoS 和pod cgroups (默认 true)

--client-ca-file=/etc/kubernetes/ssl/ca.pem 集群ca证书
--cluster-dns=10.10.10.10 DNS 服务器的IP列表,逗号分隔
--cluster-domain=xxx.xxx 集群域名, kubelet 将配置所有容器除了主机搜索域还将搜索当前域
--cni-bin-dir=/opt/cni/bin CNI插件二进制文件路径
--cni-conf-dir=/etc/cni/net.d CNI插件配置文件的完整路径
--container-runtime string

容器运行时engine(docker / rkt)

 --cpu-cfs-quota

开启cpu cfs配额来对容器指定cpu限制(默认 true)

--cpu-cfs-quota-period duration 设置cpu cfs配置周期值,cpu.cfs_period_us(default 100ms)

--enable-controller-attach-detach

开启attach detach controller来管理调度到该节点上的volume
--enforce-node-allocatable strings  默认为pods,要为kube组件和System进程预留资源,则需要设置为pods,kube-reserved,system-reserve
--event-burst int32

突发事件记录的最大值

--eviction-hard=memory.available<1000Mi,nodefs.available<10%,nodefs.inodesFree<10% 清理阈值的集合,达到该阈值将触发一次容器清理
--eviction-minimum-reclaim=memory.available=0Mi,nodefs.available=500Mi,imagefs.available=2Gi 资源回收最小值的集合,即 kubelet 压力较大时 ,执行 pod 清理回收的资源最小值
--eviction-soft=memory.available<1.5Gi 清理阈值的集合,如果达到一个清理周期将触发一次容器清理
--eviction-soft-grace-period=memory.available=300s,nodefs.available=300s,nodefs.inodesFree=300s 清理周期的集合,在触发一个容器清理之前一个软清理阈值需要保持多久
--fail-swap-on 如果设置为true则启动kubelet失败(default true)

--hairpin-mode string                       (符合值为promiscuous-bridge / hairpin-veth)

nat hairpin也可以叫端口回流或者NAT回环(default "promiscuous-bridge")

--healthz-bind-address ip

健康检查服务的IP地址(默认 127.0.0.1 )

--healthz-port int32

本地健康检查服务的端口号(默认 10248 )

--host-ipc-sources strings

允许 pod 使用宿主机 ipc 命名空间列表(default [*])

--host-network-sources strings 允许 pod 使用宿主机 net 命名空间列表(default [*])
--host-pid-sources strings 允许 pod 使用宿主机 pid 命名空间列表(default [*])
--hostname-override=xxx cluster中的node name

--http-check-frequency duration

通过 http 检查新数据的周期(default 20s)

--image-gc-high-threshold int32

磁盘使用率最大值,超过此值将执行镜像垃圾回收(default 85)

--image-gc-low-threshold int32 磁盘使用率最大值,

低于此值将停止镜像垃圾回收

(default 80)
--image-pull-progress-deadline=10m 镜像拉取进度最大时间,如果在这段时间拉取镜像没有任何进展,将取消拉取(默认 1m0s)
 --iptables-drop-bit int32

用于标记丢弃数据包的 fwmark  bit,取值范围[0,31](default 15)

--iptables-masquerade-bit int32

标记 SNAT 数据包的 fwmark bit,取值范围[0,31],此参数与 kube-proxy 中的相应参数匹配(default 14)

--kube-api-burst=30 与 kubernetes apiserver 会话时的并发数(默认 10)
--kube-api-qps=15 与 kubernetes apiserver 会话时的 QPS (默认 15)
--kube-reserved mapStringString

资源预留量,(例如cpu=200m,memory=500Mi, storage=1Gi ),针对

kubernetes 系统组件

--kubeconfig=/etc/kubernetes/kubelet.kubeconfig 用来指定如何连接到 API server
--log-dir=/var/log/kubernetes 日志文件路径
--logtostderr=false 标准输出
--max-pods=300 可以运行的容器组数目(默认 110)
--network-plugin=cni 使用cni插件
--node-ip=10.x.x.x 节点的IP地址,kubelet 将使用这个地址作为节点ip地址,主要针对多网卡
--node-labels=env=test 加入集群时贴上标签
--pod-infra-container-image= 每个 pod 中的 network/ipc 命名空间容器将使用的pause镜像
--pod-manifest-path=/etc/kubernetes/manifests  
--register-with-taints=env=test:NoSchedule 加入集群时自带的taint,用于防止node刚加入集群时会有容器调度到新机器上
--root-dir=/var/lib/k8s/kubelet kubelet 的工作目录
--registry-burst=10 拉取镜像的最大并发数,允许同时拉取的镜像数,不能超过 registry-qps ,仅当 --registry-qps 大于 0 时使用(默认 10)
--serialize-image-pulls=false 禁止一次只拉取一个镜像
--stderrthreshold=3  
--system-reserved=cpu=4,memory=5Gi 系统预留资源
--tls-cert-file=/etc/kubernetes/pki/kubelet.crt 用于 https 服务的 x509 证书的文件 (中间证书,如果有,在服务器认证后使用)。如果没有提供 --tls-cert-file 和 --tls-private-key-file , 将会生产一个自签名的证书及密钥给公开地址使用,并将其保存在 --cert-dir 指定的目录。
--tls-private-key-file=/etc/kubernetes/pki/kubelet.key 包含 x509 私钥匹配的文件
--v=4 日志级别

--address 0.0.0.0

服务监听的IP地址(默认 0.0.0.0 为 0.0.0.0 监听所有地址)

   

猜你喜欢

转载自blog.csdn.net/zhonglinzhang/article/details/85279788