mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-08-10 08:27:25 +00:00
Fix guide issues
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
## 14.1 使用 kubeadm 部署 Kubernetes
|
||||
|
||||
`kubeadm` 提供了 `kubeadm init` 以及 `kubeadm join` 这两个命令,作为快速创建 `Kubernetes` 集群的最佳实践。
|
||||
`kubeadm` 提供了 `kubeadm init` 以及 `kubeadm join` 这两个命令,作为快速创建 `Kubernetes` 集群的常用工具。
|
||||
|
||||
> **版本说明**:Kubernetes 版本更新较快 (约每 4 个月一个新版本),本文档基于 Kubernetes 1.35 编写。请访问 [Kubernetes 官方发布页](https://kubernetes.io/releases/)获取最新版本信息。
|
||||
> **版本说明**:Kubernetes 版本更新较快 (约每 4 个月一个新版本),本文档基于 Kubernetes 1.35 编写。更完整的安装和兼容性说明请以 [Kubernetes 官方 kubeadm 文档](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/) 和 [containerd 官方文档](https://containerd.io/docs/) 为准。
|
||||
|
||||
### 14.1.1 安装 containerd
|
||||
|
||||
@@ -20,187 +20,24 @@ $ sudo yum install containerd.io
|
||||
|
||||
### 14.1.2 配置 containerd
|
||||
|
||||
生成默认配置文件:
|
||||
先生成默认配置文件,然后只调整与 kubeadm 相关的关键项:
|
||||
|
||||
```bash
|
||||
$ sudo mkdir -p /etc/containerd
|
||||
$ containerd config default | sudo tee /etc/containerd/config.toml > /dev/null
|
||||
```
|
||||
|
||||
修改 `/etc/containerd/config.toml` 配置文件
|
||||
打开 `/etc/containerd/config.toml`,确认 `runc` 选项使用 `systemd` cgroup 驱动:
|
||||
|
||||
```toml
|
||||
version = 2
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||
SystemdCgroup = true
|
||||
```
|
||||
|
||||
## persistent data location
|
||||
默认配置里的其它内容通常可以保持不变。修改完成后重启 containerd:
|
||||
|
||||
root = "/var/lib/containerd"
|
||||
|
||||
## runtime state information
|
||||
|
||||
state = "/run/containerd"
|
||||
plugin_dir = ""
|
||||
disabled_plugins = []
|
||||
required_plugins = []
|
||||
|
||||
## set containerd's OOM score
|
||||
|
||||
oom_score = 0
|
||||
|
||||
[grpc]
|
||||
address = "/run/containerd/containerd.sock"
|
||||
tcp_address = ""
|
||||
tcp_tls_cert = ""
|
||||
tcp_tls_key = ""
|
||||
# socket uid
|
||||
|
||||
uid = 0
|
||||
# socket gid
|
||||
|
||||
gid = 0
|
||||
max_recv_message_size = 16777216
|
||||
max_send_message_size = 16777216
|
||||
|
||||
[debug]
|
||||
address = ""
|
||||
format = "json"
|
||||
uid = 0
|
||||
gid = 0
|
||||
level = ""
|
||||
|
||||
[metrics]
|
||||
address = "127.0.0.1:1338"
|
||||
grpc_histogram = false
|
||||
|
||||
[cgroup]
|
||||
path = ""
|
||||
|
||||
[timeouts]
|
||||
"io.containerd.timeout.shim.cleanup" = "5s"
|
||||
"io.containerd.timeout.shim.load" = "5s"
|
||||
"io.containerd.timeout.shim.shutdown" = "3s"
|
||||
"io.containerd.timeout.task.state" = "2s"
|
||||
|
||||
[plugins]
|
||||
[plugins."io.containerd.gc.v1.scheduler"]
|
||||
pause_threshold = 0.02
|
||||
deletion_threshold = 0
|
||||
mutation_threshold = 100
|
||||
schedule_delay = "0s"
|
||||
startup_delay = "100ms"
|
||||
[plugins."io.containerd.grpc.v1.cri"]
|
||||
disable_tcp_service = true
|
||||
stream_server_address = "127.0.0.1"
|
||||
stream_server_port = "0"
|
||||
stream_idle_timeout = "4h0m0s"
|
||||
enable_selinux = false
|
||||
selinux_category_range = 1024
|
||||
sandbox_image = "registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.10"
|
||||
stats_collect_period = 10
|
||||
# systemd_cgroup = false
|
||||
|
||||
enable_tls_streaming = false
|
||||
max_container_log_line_size = 16384
|
||||
disable_cgroup = false
|
||||
disable_apparmor = false
|
||||
restrict_oom_score_adj = false
|
||||
max_concurrent_downloads = 3
|
||||
disable_proc_mount = false
|
||||
unset_seccomp_profile = ""
|
||||
tolerate_missing_hugetlb_controller = true
|
||||
disable_hugetlb_controller = true
|
||||
ignore_image_defined_volumes = false
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd]
|
||||
snapshotter = "overlayfs"
|
||||
default_runtime_name = "runc"
|
||||
no_pivot = false
|
||||
disable_snapshot_annotations = false
|
||||
discard_unpacked_layers = false
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
|
||||
runtime_type = "io.containerd.runc.v2"
|
||||
pod_annotations = []
|
||||
container_annotations = []
|
||||
privileged_without_host_devices = false
|
||||
base_runtime_spec = ""
|
||||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
|
||||
# SystemdCgroup enables systemd cgroups.
|
||||
|
||||
SystemdCgroup = true
|
||||
# BinaryName is the binary name of the runc binary.
|
||||
|
||||
# BinaryName = "runc"
|
||||
|
||||
# BinaryName = "crun"
|
||||
|
||||
# NoPivotRoot disables pivot root when creating a container.
|
||||
|
||||
# NoPivotRoot = false
|
||||
|
||||
# NoNewKeyring disables new keyring for the container.
|
||||
|
||||
# NoNewKeyring = false
|
||||
|
||||
# ShimCgroup places the shim in a cgroup.
|
||||
|
||||
# ShimCgroup = ""
|
||||
|
||||
# IoUid sets the I/O's pipes uid.
|
||||
|
||||
# IoUid = 0
|
||||
|
||||
# IoGid sets the I/O's pipes gid.
|
||||
|
||||
# IoGid = 0
|
||||
|
||||
# Root is the runc root directory.
|
||||
|
||||
Root = ""
|
||||
|
||||
# CriuPath is the criu binary path.
|
||||
|
||||
# CriuPath = ""
|
||||
|
||||
# CriuImagePath is the criu image path
|
||||
|
||||
# CriuImagePath = ""
|
||||
|
||||
# CriuWorkPath is the criu work path.
|
||||
|
||||
# CriuWorkPath = ""
|
||||
|
||||
[plugins."io.containerd.grpc.v1.cri".cni]
|
||||
bin_dir = "/opt/cni/bin"
|
||||
conf_dir = "/etc/cni/net.d"
|
||||
max_conf_num = 1
|
||||
conf_template = ""
|
||||
[plugins."io.containerd.grpc.v1.cri".registry]
|
||||
config_path = "/etc/containerd/certs.d"
|
||||
[plugins."io.containerd.grpc.v1.cri".registry.headers]
|
||||
# Foo = ["bar"]
|
||||
|
||||
[plugins."io.containerd.grpc.v1.cri".image_decryption]
|
||||
key_model = ""
|
||||
[plugins."io.containerd.grpc.v1.cri".x509_key_pair_streaming]
|
||||
tls_cert_file = ""
|
||||
tls_key_file = ""
|
||||
[plugins."io.containerd.internal.v1.opt"]
|
||||
path = "/opt/containerd"
|
||||
[plugins."io.containerd.internal.v1.restart"]
|
||||
interval = "10s"
|
||||
[plugins."io.containerd.metadata.v1.bolt"]
|
||||
content_sharing_policy = "shared"
|
||||
[plugins."io.containerd.monitor.v1.cgroups"]
|
||||
no_prometheus = false
|
||||
[plugins."io.containerd.runtime.v2.task"]
|
||||
platforms = ["linux/amd64"]
|
||||
[plugins."io.containerd.service.v1.diff-service"]
|
||||
default = ["walking"]
|
||||
[plugins."io.containerd.snapshotter.v1.devmapper"]
|
||||
root_path = ""
|
||||
pool_name = ""
|
||||
base_image_size = ""
|
||||
async_remove = false
|
||||
```bash
|
||||
$ sudo systemctl restart containerd
|
||||
```
|
||||
|
||||
### 14.1.3 安装 **kubelet**、**kubeadm**、**kubectl**、**cri-tools**、**kubernetes-cni**
|
||||
@@ -436,8 +273,3 @@ $ kubectl taint nodes --all node-role.kubernetes.io/master-
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
### 14.1.11 参考文档
|
||||
|
||||
* [官方文档](https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
|
||||
* [Container runtimes](https://kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd)
|
||||
|
||||
@@ -287,7 +287,3 @@ $ kubectl taint nodes --all node-role.kubernetes.io/master-
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
### 14.2.11 参考文档
|
||||
|
||||
* [官方文档](https://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm/)
|
||||
|
||||
@@ -50,13 +50,7 @@ sudo systemctl status kubelet
|
||||
sudo systemctl enable kubelet
|
||||
```
|
||||
|
||||
### 参考资源
|
||||
|
||||
详细的部署步骤和配置说明,可以参考以下项目:
|
||||
|
||||
- [opsnull/follow-me-install-kubernetes-cluster](https://github.com/opsnull/follow-me-install-kubernetes-cluster):一个完整的 Kubernetes 集群部署指南项目
|
||||
|
||||
该项目提供了详细的步骤说明,涵盖 Master 节点、Worker 节点的安装配置,以及如何使用 systemd 管理这些组件的生命周期。
|
||||
如果希望查看更完整的 systemd 部署案例,可以参考 `opsnull/follow-me-install-kubernetes-cluster` 这类社区项目,再结合本章前文的 kubeadm 与组件配置说明理解整体流程。
|
||||
|
||||
### 推荐学习路径
|
||||
|
||||
|
||||
@@ -40,8 +40,3 @@ $ kubectl create token dashboard-admin -n kubernetes-dashboard
|
||||
```
|
||||
|
||||
将输出的令牌粘贴到登录页面,即可登录。
|
||||
|
||||
### 14.7.4 参考文档
|
||||
|
||||
* [官方文档](https://kubernetes.io/zh/docs/tasks/access-application-cluster/web-ui-dashboard/)
|
||||
* [Headlamp](https://headlamp.dev/)(推荐的替代方案)
|
||||
|
||||
Reference in New Issue
Block a user