@@ -12,43 +12,31 @@ content_type: task
12
12
13
13
<!-- overview -->
14
14
15
- {{< feature-state for_k8s_version="v1.10" state="beta" >}}
16
-
17
15
<!--
18
16
A subset of the Kubelet's configuration parameters may be
19
17
set via an on-disk config file, as a substitute for command-line flags.
20
- This functionality is considered beta in v1.10.
21
18
--->
22
19
通过保存在硬盘的配置文件设置 kubelet 的部分配置参数,这可以作为命令行参数的替代。
23
- 此功能在 v1.10 中为 beta 版。
24
20
25
21
<!--
26
22
Providing parameters via a config file is the recommended approach because
27
23
it simplifies node deployment and configuration management.
28
24
--->
29
25
建议通过配置文件的方式提供参数,因为这样可以简化节点部署和配置管理。
30
26
31
- ## {{% heading "prerequisites" %}}
32
-
33
- <!--
34
- - A v1.10 or higher Kubelet binary must be installed for beta functionality.
35
- -->
36
- - 需要安装 1.10 或更高版本的 kubelet 可执行文件,才能使用此 beta 功能。
37
-
38
27
<!-- steps -->
39
28
40
29
<!--
41
30
## Create the config file
42
31
43
32
The subset of the Kubelet's configuration that can be configured via a file
44
- is defined by the `KubeletConfiguration` struct
45
- [here (v1beta1)](https://github.com/kubernetes/kubernetes/blob/{{< param "docsbranch" >}}/staging/src/k8s.io/kubelet/config/v1beta1/types.go).
33
+ is defined by the
34
+ [`KubeletConfiguration`](/docs/reference/config-api/kubelet-config.v1beta1/)
35
+ struct.
46
36
-->
47
37
## 创建配置文件
48
38
49
- ` KubeletConfiguration ` 结构体定义了可以通过文件配置的 Kubelet 配置子集,
50
- 该结构体在 [ 这里(v1beta1)] (https://github.com/kubernetes/kubernetes/blob/{{ < param "docsbranch" >}}/staging/src/k8s.io/kubelet/config/v1beta1/types.go)
51
- 可以找到。
39
+ [ ` KubeletConfiguration ` ] ( /zh/docs/reference/config-api/kubelet-config.v1beta1/ ) 结构体定义了可以通过文件配置的 Kubelet 配置子集,
52
40
53
41
<!--
54
42
The configuration file must be a JSON or YAML representation of the parameters
@@ -60,38 +48,47 @@ Here is an example of what this file might look like:
60
48
确保 kubelet 可以读取该文件。
61
49
62
50
下面是一个 Kubelet 配置文件示例:
63
-
64
- ``` yaml
65
- kind : KubeletConfiguration
51
+ ```
66
52
apiVersion: kubelet.config.k8s.io/v1beta1
53
+ kind: KubeletConfiguration
54
+ address: "192.168.0.8",
55
+ port: 20250,
56
+ serializeImagePulls: false,
67
57
evictionHard:
68
58
memory.available: "200Mi"
69
59
```
70
60
61
+
71
62
<!--
72
- In the example, the Kubelet is configured to evict Pods when available memory drops below 200Mi.
63
+ In the example, the Kubelet is configured to serve on IP address 192.168.0.8 and port 20250, pull images in parallel,
64
+ and evict Pods when available memory drops below 200Mi.
73
65
All other Kubelet configuration values are left at their built-in defaults, unless overridden
74
66
by flags. Command line flags which target the same value as a config file will override that value.
75
-
76
- For a trick to generate a configuration file from a live node, see
77
- [Reconfigure a Node's Kubelet in a Live Cluster](/docs/tasks/administer-cluster/reconfigure-kubelet).
78
67
-->
79
- 在这个示例中, 当可用内存低于 200Mi 时, kubelet 将会开始驱逐 Pods。
68
+ 在这个示例中, Kubelet 被设置为在地址 192.168.0.8 端口 20250 上提供服务,以并行方式拖拽镜像,
69
+ 当可用内存低于 200Mi 时, kubelet 将会开始驱逐 Pods。
80
70
没有声明的其余配置项都将使用默认值,除非使用命令行参数来重载。
81
71
命令行中的参数将会覆盖配置文件中的对应值。
82
72
83
- 作为一个小技巧,你可以从活动节点生成配置文件,相关方法请查看
84
- [重新配置活动集群节点的 kubelet](/zh/docs/tasks/administer-cluster/reconfigure-kubelet)。
85
-
86
73
<!--
87
74
## Start a Kubelet process configured via the config file
88
75
76
+ {{< note >}}
77
+ If you use kubeadm to initialize your cluster, use the kubelet-config while creating your cluster with `kubeadmin init`.
78
+ See [configuring kubelet using kubeadm](/docs/setup/production-environment/tools/kubeadm/kubelet-integration/) for details.
79
+ {{< /note >}}
80
+
89
81
Start the Kubelet with the `--config` flag set to the path of the Kubelet's config file.
90
82
The Kubelet will then load its config from this file.
91
83
--->
92
84
93
85
## 启动通过配置文件配置的 Kubelet 进程
94
86
87
+ {{< note >}}
88
+ 如果你使用 kubeadm 初始化你的集群,在使用 ` kubeadmin init ` 创建你的集群的时候请使用 kubelet-config。
89
+ 更多细节请阅读[ 使用 kubeadm 配置 kubelet] ( /zh/docs/setup/production-environment/tools/kubeadm/kubelet-integration/ )
90
+ {{< /note >}}
91
+
95
92
启动 Kubelet 需要将 ` --config ` 参数设置为 Kubelet 配置文件的路径。Kubelet 将从此文件加载其配置。
96
93
97
94
<!--
@@ -121,17 +118,12 @@ In the above example, this version is `kubelet.config.k8s.io/v1beta1`.
121
118
122
119
<!-- discussion -->
123
120
124
- <!--
125
- # # Relationship to Dynamic Kubelet Config
121
+ ## {{% heading "whatsnext" %}}
126
122
127
- If you are using the [Dynamic Kubelet Configuration](/docs/tasks/administer-cluster/reconfigure-kubelet)
128
- feature, the combination of configuration provided via `--config` and any flags which override these values
129
- is considered the default "last known good" configuration by the automatic rollback mechanism.
123
+ <!--
124
+ - Learn more about kubelet configuration by checking the
125
+ [`KubeletConfiguration`](/docs/reference/config-api/kubelet-config.v1beta1/)
126
+ reference.
130
127
--->
131
- # # 与动态 Kubelet 配置的关系
132
-
133
- 如果你正在使用[动态 kubelet 配置](/zh/docs/tasks/administer-cluster/reconfigure-kubelet)特性,
134
- 那么自动回滚机制将认为通过 `--config` 提供的配置与覆盖这些值的任何参数的组合是
135
- " 最后已知正常(last known good)" 的配置。
136
-
137
-
128
+ - 参阅 [ ` KubeletConfiguration ` ] ( /zh/docs/reference/config-api/kubelet-config.v1beta1/ )
129
+ 进一步学习 kubelet 的配置。
0 commit comments