[*] 修改时区
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 44s

This commit is contained in:
Martin 2025-01-26 11:20:10 +08:00
parent 2f9c5b5faf
commit b9e4ed3065
3 changed files with 75 additions and 3 deletions

View File

@ -28,6 +28,7 @@ server ntp5.aliyun.com iburst
driftfile /var/lib/chrony/drift
allow 127.0.0.1
EOF
timedatectl set-timezone Asia/Shanghai
systemctl restart chrony && systemctl enable chrony
else
echo "systemctl 不存在,跳过 chrony 的重启"

View File

@ -39,11 +39,11 @@ sudo mv containerd.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start containerd
sudo systemctl enable --now containerd
sudo systemctl status containerd
# 初始化 containerd 配置
mkdir "/etc/containerd"
containerd config default | sudo tee /etc/containerd/config.toml > /dev/null
containerd config default > /etc/containerd/config.toml
sed -ri '0,/(config_path).*/s@(config_path).*@\1 = "/etc/containerd/certs.d"@' /etc/containerd/config.toml
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
@ -94,7 +94,7 @@ server = "https://registry.k8s.io"
override_path = true
EOF
sudo systemctl restart containerd && sudo systemctl enable containerd
sudo systemctl restart containerd && sudo systemctl enable --now containerd
# ctr image pull registry.k8s.io/pause:3.10
# ctr image pull --hosts-dir /etc/containerd/certs.d registry.k8s.io/pause:3.10

71
k8s/README.md Normal file
View File

@ -0,0 +1,71 @@
##
```bash
# 配置主机 host
cat >> /etc/hosts <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
```
```bash
cat <<EOF | sudo tee kubeadm-config.yaml
apiVersion: kubeadm.k8s.io/v1beta4
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: b77tyr.n7bk46h0947nddkb
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 10.1.2.200
bindPort: 6443
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
imagePullPolicy: IfNotPresent
imagePullSerial: true
name: k8s-test
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
timeouts:
controlPlaneComponentHealthCheck: 4m0s
discovery: 5m0s
etcdAPICall: 2m0s
kubeletHealthCheck: 4m0s
kubernetesAPICall: 1m0s
tlsBootstrap: 5m0s
upgradeManifests: 5m0s
---
apiServer: {}
apiVersion: kubeadm.k8s.io/v1beta4
caCertificateValidityPeriod: 87600h0m0s
certificateValidityPeriod: 8760h0m0s
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: $(hostname):6443
controllerManager: {}
dns:
imageRepository: docker.martin98.com/k8s/coredns
encryptionAlgorithm: RSA-2048
etcd:
local:
dataDir: /var/lib/etcd
imageRepository: docker.martin98.com/k8s
kind: ClusterConfiguration
kubernetesVersion: v1.32.1
networking:
dnsDomain: cluster.local
podSubnet: 10.101.0.0/16
serviceSubnet: 10.100.0.0/16
proxy: {}
scheduler: {}
EOF
kubeadm init --config=kubeadm-config.yaml
```