본문 바로가기

Cloud/Kubernetes

[Kubernetes] kernel 변수 설정

Kubernetes에서 Oracle이나 Tibero와 같은 DB에서 커널 변수를 설정을 해줘야 Pod가 생성되거나 실행이 되는 경우가 있다. 이를 Kubernetes에서 설정하는 방법은 아래와 같다.

#kernel 설정

 

# vi /etc/sysctl.conf
---
fs.aio-max-nr=1048576

fs.file-max=6815744
net.core.rmem_max=67108864
net.core.wmem_max=67108864

# 적용 확인
# sysctl -p

 

# vi /etc/security/limits.conf
---
    root soft memlock unlimited
    root hard memlock unlimited
    root soft nofile 65536
    root hard nofile 65536
    root soft nproc unlimited
    root hard nproc unlimited
    root soft stack 10240
---
# reboot -f

# 적용 확인
# ulimit -a

 

# crio 설정
# vi /etc/crio/crio.conf
---
pids_limit = 32768

 

# kubelet 설정
# vi /etc/usr/lib/systemd/system/kubelet.service.d/10-kubeadm-conf
---
ExecStart=/usr/bin/kubelet --allowed-unsafe-sysctls=kernel.sem $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
---
# systemctl daemon-reload
# systemctl restart kubelet