This commit is contained in:
2024-07-02 19:58:16 +07:00
commit 679596c21c
45 changed files with 4022 additions and 0 deletions

52
1.k8s/README.md Normal file
View File

@@ -0,0 +1,52 @@
# k8s кластер
## Нужно
1. rke - <https://github.com/rancher/rke/releases>
2. k8s-lens - <https://docs.k8slens.dev>
3. helm - <https://helm.sh/docs/intro/quickstart/>
4. Три машины на ubuntu 22.04 + docker
## Разворачиваем куб
1. `rke up --ignore-docker-version`
2. полученный конфиг импортируем в линзу
3. в настройках подключаем метрики
## Полезные команды
```bash
apt update && apt install -y mc htop zip wget curl git jq net-tools gnupg2 screen open-iscsi
curl https://get.docker.com -o install.sh && sh install.sh
```
## Твики
### is apparently in use by the system; will not make a filesystem here!
* Create the default configuration file /etc/multipath.conf if not existed
* Add the following line to blacklist section devnode "^sd[a-z0-9]+"
```config
blacklist {
devnode "^sd[a-z0-9]+"
}
```
* Restart multipath service# systemctl restart multipathd.service
* Verify that configuration is applied# multipath -t
### Failed to allocate directory watch: Too many open files
на всех нодах кластера:
```bash
sysctl fs.inotify.max_user_watches=65536
sysctl fs.inotify.max_user_instances=8192
sysctl net.ipv4.tcp_max_syn_backlog=100000
sysctl net.core.somaxconn=100000
sysctl net.ipv4.tcp_wmem='4096 12582912 16777216'
sysctl net.ipv4.tcp_rmem='4096 12582912 16777216'
sysctl net.ipv4.ip_local_port_range='10240 65535'
```

56
1.k8s/cluster.yml Normal file
View File

@@ -0,0 +1,56 @@
cluster_name: k8s-zalando
kubernetes_version: "v1.28.10-rancher1-1"
enable_cri_dockerd: true
ignore_docker_version: true
nodes:
- address: 192.168.23.101
hostname_override: node-01
user: root
labels:
location: pve1-nsk
role: [controlplane, worker, etcd]
- address: 192.168.23.102
hostname_override: node-02
user: root
labels:
location: pve1-nsk
role: [controlplane, worker, etcd]
- address: 192.168.23.103
hostname_override: node-03
user: root
labels:
location: pve1-nsk
role: [controlplane, worker, etcd]
services:
etcd:
snapshot: true
creation: 6h
retention: 30h
kubelet:
extra_args:
max-pods: 350
ingress:
provider: nginx
node_selector:
orc_ingress: yes
monitoring:
provider: metrics-server
replicas: 0
# authentication:
# strategy: x509
# sans:
# - "192.168.23.2"
#dns:
# provider: coredns
# upstreamnameservers:
# - 8.8.8.8
# - 1.1.1.1