'Linux' 카테고리의 다른 글
MTU Ping Test (0) | 2023.04.24 |
---|---|
ssh 터널링 (0) | 2023.04.05 |
dd 명령어 (0) | 2023.03.22 |
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
MTU Ping Test (0) | 2023.04.24 |
---|---|
ssh 터널링 (0) | 2023.04.05 |
dd 명령어 (0) | 2023.03.22 |
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
[Linux] ifenslave 명령어 (Bonding Adaptor Active Change / 본딩 어댑터 전환) (0) | 2023.06.20 |
---|---|
ssh 터널링 (0) | 2023.04.05 |
dd 명령어 (0) | 2023.03.22 |
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
[root@brightforest ~]# more tunnul
ssh -D 0.0.0.0:6666 10.1.10.10
브라우저 - 설정 - 네트워크 설정
SOCKS 호스트 : 192.168.110.1
포트 : 6666
------------------
PC - HOST - VM
local - 192.168.110.1 - 10.10.0.10
1. VM → HOST
ssh -R 7777:localhost:8081 192.168.110.1
2. PC → HOST
ssh -L 7777:localhost:7777 root@192.168.110.1
web - localhost:7777
------------------
A(211.234.234.234 -p 34522) |방화벽| B(192.168.110.1) C(172.21.10.1)
(1) A에서 C로 연결하기 위해 B → A로 Proxy 설정 (B에서 수행)
ssh -R 60020:172.21.10.1:22 root@211.234.234.234 -p 34522
(2) A → C로 연결 (A에서 수행)
ssh user01@localhost -p 60020
참고)
[Linux] ifenslave 명령어 (Bonding Adaptor Active Change / 본딩 어댑터 전환) (0) | 2023.06.20 |
---|---|
MTU Ping Test (0) | 2023.04.24 |
dd 명령어 (0) | 2023.03.22 |
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
# b1 1MB 500개로 이루어진 파일 10개 생성
# 500MB * 10개
for i in {1..10}; do echo $i; dd if=/dev/zero of=$i bs=1MB count=500; sleep 2; done
# bs 1GB 15개로 이루어진 15GB 크기의 file1 파일 생성
dd if=/dev/zero of=file1 bs=1GB count=15
MTU Ping Test (0) | 2023.04.24 |
---|---|
ssh 터널링 (0) | 2023.04.05 |
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
[Ubuntu] 20.04 -> 22.04 업그레이드 (0) | 2023.02.24 |
1. Python 설치
# Install ansible
apt install ansible
# Set Virtual-env
apt install python3.8-venv
source k8s-venv/bin/activate
pip install ansible==4.10.0
2. yaml 파일 생성
# update-root-pw.yaml
---
- hosts: all
gather_facts: no
tasks:
- name: Update Root user's Password
user:
name: root
update_password: always
password: "{{ PASSWORD | password_hash('sha512') }}"
3. ansible-hosts 파일 생성
# ansible-hosts
[all]
user01-deploy ansible_host=192.168.110.10 ip=192.168.110.10
user01-master1 ansible_host=192.168.110.11 ip=192.168.110.11
user01-master2 ansible_host=192.168.110.12 ip=192.168.110.12
user01-master3 ansible_host=192.168.110.13 ip=192.168.110.13
user01-worker1 ansible_host=192.168.110.14 ip=192.168.110.14
user01-worker2 ansible_host=192.168.110.15 ip=192.168.110.15
user02-deploy ansible_host=192.168.110.20 ip=192.168.110.20
user02-master1 ansible_host=192.168.110.21 ip=192.168.110.21
user02-master2 ansible_host=192.168.110.22 ip=192.168.110.22
user02-master3 ansible_host=192.168.110.23 ip=192.168.110.23
user02-worker1 ansible_host=192.168.110.24 ip=192.168.110.24
user02-worker2 ansible_host=192.168.110.25 ip=192.168.110.25
user03-deploy ansible_host=192.168.110.30 ip=192.168.110.30
user03-master1 ansible_host=192.168.110.31 ip=192.168.110.31
user03-master2 ansible_host=192.168.110.32 ip=192.168.110.32
user03-master3 ansible_host=192.168.110.33 ip=192.168.110.33
user03-worker1 ansible_host=192.168.110.34 ip=192.168.110.34
user03-worker2 ansible_host=192.168.110.35 ip=192.168.110.35
4. 적용
ansible-playbook -i ansible-hosts update-root-pw.yaml --extra-vars "PASSWORD=passwd123$"
기타) root 로그인 허용
ansible -m shell -a "sed -i \"s/# StrictHostKeyChecking*/StrictHostKeyChecking no/\" /etc/ssh/sshd_config" -i ansible-hosts all
ansible -m shell -a "sed -i \"s/#PermitRootLogin.*/PermitRootLogin yes/\" /etc/ssh/sshd_config" -i /tmp/sllee/ansible-hosts all
ssh 터널링 (0) | 2023.04.05 |
---|---|
dd 명령어 (0) | 2023.03.22 |
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
[Ubuntu] 20.04 -> 22.04 업그레이드 (0) | 2023.02.24 |
[CentOS7] Ansible 5.x 설치 (0) | 2023.02.09 |
목표
- 5.15.0-60-generic 버전으로 업그레이드
1. package repository 최신화 및 update 대상 확인
# apt-get update
# apt-cache search linux | grep '5.15.0-60-generic'
2. kernel upgrade 수행
# apt-get install linux-image-5.15.0-60-generic linux-headers-5.15.0-60-generic linux-modules-5.15.0-60-generic linux-modules-extra-5.15.0-60-generic
# dpkg -l | grep linux
# update-grub2
3. kernel upgrade 적용 확인
# cat /boot/grub/grub.cfg | grep gnulinux
# ls -alt /boot/ | grep initrd
# sync;sync;sync
# reboot * 시스템 상태 확인
# df -Ph
# timedatectl
# chronyc sources
* 시스템 message 확인
# cat /var/log/messages |grep -i fail
# cat /var/log/messages |grep -i error
# dmesg |grep -i fail
# dmesg |grep -i error
* 커널 업데이트 확인
# uname -r (5.15.0-60-generic)
dd 명령어 (0) | 2023.03.22 |
---|---|
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
[Ubuntu] 20.04 -> 22.04 업그레이드 (0) | 2023.02.24 |
[CentOS7] Ansible 5.x 설치 (0) | 2023.02.09 |
[ubuntu] systemd에 관하여 (0) | 2022.10.24 |
테스트 - 총 50분 소요
대상서버 : 192.168.110.115 k8s-worker02
기존 설정
root@k8s-master01:~# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master01 Ready control-plane 56d v1.24.6 192.168.110.111 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-master02 Ready control-plane 56d v1.24.6 192.168.110.112 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-master03 Ready control-plane 56d v1.24.6 192.168.110.113 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-worker01 Ready <none> 56d v1.24.6 192.168.110.114 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-worker02 Ready <none> 56d v1.24.6 192.168.110.115 <none> Ubuntu 20.04.5 LTS 5.4.0-135-generic containerd://1.6.8
Kubernetes 프로세스 종료
root@k8s-worker02:~# systemctl stop kubelet
root@k8s-worker02:~# systemctl stop containerd.service
업그레이드
sudo apt update && sudo apt upgrade -y
...
Configuration file '/etc/cloud/cloud.cfg'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** cloud.cfg (Y/I/N/O/D/Z) [default=N] ?
N
root@k8s-worker02:~# sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
cgroupfs-mount pigz
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2. 불필요 패키지 삭제
root@k8s-worker02:~# sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
cgroupfs-mount pigz
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 292 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 96247 files and directories currently installed.)
Removing cgroupfs-mount (1.4) ...
Removing pigz (2.4-1) ...
Processing triggers for man-db (2.9.1-1) ...
3. 코어 업데이트를 위한 패키지 설치
root@k8s-worker02:~# sudo apt install update-manager-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
update-manager-core is already the newest version (1:20.04.10.11).
update-manager-core set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4. 업그레이드
root@k8s-worker02:~# sudo do-release-upgrade
Checking for a new Ubuntu release
You have not rebooted after updating a package which requires a reboot. Please reboot before upgrading.
root@k8s-worker02:~# reboot
nginx 종료 기다리고 있어서 하드리부트
재시도
root@k8s-worker02:~# sudo do-release-upgrade
...
If you continue, an additional ssh daemon will be started at port
'1022'.
Do you want to continue?
Continue [yN] y
---
Do you want to start the upgrade?
5 packages are going to be removed. 105 new packages are going to be
installed. 575 packages are going to be upgraded.
You have to download a total of 567 M. This download will take about
2 minutes with your connection.
Installing the upgrade can take several hours. Once the download has
finished, the process cannot be canceled.
Continue [yN] Details [d]
y
...
yes
...
Configuration file '/etc/systemd/resolved.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** resolved.conf (Y/I/N/O/D/Z) [default=N] ?
N
...
중간에 GUI 화면으로 커널 버전 그대로 쓸건지 물어봄 (default : 기존버전사용)
root@k8s-worker02:~# uname -a
Linux k8s-worker02 5.4.0-139-generic #156-Ubuntu SMP Fri Jan 20 17:27:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@k8s-worker02:~#
root@k8s-worker02:~# more /etc/*release
::::::::::::::
/etc/lsb-release
::::::::::::::
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
커널 업데이트(5.19 테스트)
sudo add-apt-repository ppa:cappelikan/ppa -y
sudo apt install mainline -y
https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19-rc8/
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19-rc8/amd64/linux-headers-5.19.0-051900rc8_5.19.0-051900rc8.202207242130_all.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19-rc8/amd64/linux-image-unsigned-5.19.0-051900rc8-generic_5.19.0-051900rc8.202207242130_amd64.deb
wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.19-rc8/amd64/linux-modules-5.19.0-051900rc8-generic_5.19.0-051900rc8.202207242130_amd64.deb
root@k8s-worker02:~# sudo dpkg -i *.deb
reboot -f
root@k8s-worker02:~# uname -r
5.19.0-051900rc8-generic
root@k8s-worker02:~# more /etc/*release
::::::::::::::
/etc/lsb-release
::::::::::::::
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
root@k8s-master01:~# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master01 Ready control-plane 56d v1.24.6 192.168.110.111 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-master02 Ready control-plane 56d v1.24.6 192.168.110.112 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-master03 Ready control-plane 56d v1.24.6 192.168.110.113 <none> Ubuntu 22.04.2 LTS 5.15.0-60-generic containerd://1.6.8
k8s-worker01 Ready <none> 56d v1.24.6 192.168.110.114 <none> Ubuntu 20.04.4 LTS 5.4.0-135-generic containerd://1.6.8
k8s-worker02 Ready <none> 56d v1.24.6 192.168.110.115 <none> Ubuntu 22.04.2 LTS 5.19.0-051900rc8-generic containerd://1.6.8
root@k8s-master01:~# kubectl -n kube-system get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
calico-kube-controllers-56fd7b8dc-n42cb 1/1 Running 78 (15d ago) 56d 192.168.110.114 k8s-worker01 <none> <none>
calico-node-6jmxc 1/1 Running 1 (52d ago) 56d 192.168.110.111 k8s-master01 <none> <none>
calico-node-k7jpb 1/1 Running 4 (40d ago) 56d 192.168.110.114 k8s-worker01 <none> <none>
calico-node-lpf6w 1/1 Running 7 (78m ago) 56d 192.168.110.115 k8s-worker02 <none> <none>
calico-node-x55bh 1/1 Running 1 (52d ago) 56d 192.168.110.112 k8s-master02 <none> <none>
calico-node-zf7p9 1/1 Running 2 (2m17s ago) 56d 192.168.110.113 k8s-master03 <none> <none>
coredns-75dbf65849-m7kl7 1/1 Running 0 66m 10.233.113.6 k8s-master02 <none> <none>
coredns-75dbf65849-mtt7d 1/1 Running 0 52d 10.233.66.3 k8s-master01 <none> <none>
csi-nfs-controller-6495ffdf79-dlgkm 3/3 Running 0 123m 192.168.110.114 k8s-worker01 <none> <none>
csi-nfs-node-4mwrh 3/3 Running 10 (2m17s ago) 51d 192.168.110.113 k8s-master03 <none> <none>
csi-nfs-node-6nllb 3/3 Running 0 51d 192.168.110.111 k8s-master01 <none> <none>
csi-nfs-node-h9jdc 3/3 Running 8 (78m ago) 51d 192.168.110.115 k8s-worker02 <none> <none>
csi-nfs-node-mkd92 3/3 Running 2 (15d ago) 51d 192.168.110.114 k8s-worker01 <none> <none>
csi-nfs-node-tp56l 3/3 Running 0 51d 192.168.110.112 k8s-master02 <none> <none>
dns-autoscaler-59b8867c86-tzbwm 1/1 Running 1 (52d ago) 56d 10.233.113.4 k8s-master02 <none> <none>
etcd-k8s-master01 1/1 Running 3 (15d ago) 56d 192.168.110.111 k8s-master01 <none> <none>
etcd-k8s-master02 1/1 Running 3 (15d ago) 56d 192.168.110.112 k8s-master02 <none> <none>
etcd-k8s-master03 1/1 Running 4 (2m17s ago) 56d 192.168.110.113 k8s-master03 <none> <none>
kube-apiserver-k8s-master01 1/1 Running 50 (15d ago) 56d 192.168.110.111 k8s-master01 <none> <none>
kube-apiserver-k8s-master02 1/1 Running 48 (15d ago) 56d 192.168.110.112 k8s-master02 <none> <none>
kube-apiserver-k8s-master03 1/1 Running 40 (2m17s ago) 56d 192.168.110.113 k8s-master03 <none> <none>
kube-controller-manager-k8s-master01 1/1 Running 389 (25h ago) 56d 192.168.110.111 k8s-master01 <none> <none>
kube-controller-manager-k8s-master02 1/1 Running 407 (4h53m ago) 56d 192.168.110.112 k8s-master02 <none> <none>
kube-controller-manager-k8s-master03 1/1 Running 395 (2m17s ago) 56d 192.168.110.113 k8s-master03 <none> <none>
kube-proxy-7lwpx 1/1 Running 1 (52d ago) 56d 192.168.110.111 k8s-master01 <none> <none>
kube-proxy-7p2hw 1/1 Running 2 (2m17s ago) 56d 192.168.110.113 k8s-master03 <none> <none>
kube-proxy-gwhtf 1/1 Running 2 (78m ago) 56d 192.168.110.115 k8s-worker02 <none> <none>
kube-proxy-tcrq7 1/1 Running 0 56d 192.168.110.114 k8s-worker01 <none> <none>
kube-proxy-tr8fq 1/1 Running 1 (52d ago) 56d 192.168.110.112 k8s-master02 <none> <none>
kube-scheduler-k8s-master01 1/1 Running 382 (45h ago) 56d 192.168.110.111 k8s-master01 <none> <none>
kube-scheduler-k8s-master02 1/1 Running 402 (4h53m ago) 56d 192.168.110.112 k8s-master02 <none> <none>
kube-scheduler-k8s-master03 1/1 Running 393 (2m17s ago) 56d 192.168.110.113 k8s-master03 <none> <none>
metrics-server-5ccdd99954-vn7p9 1/1 Running 0 38d 10.233.125.3 k8s-worker01 <none> <none>
nginx-proxy-k8s-worker01 1/1 Running 0 56d 192.168.110.114 k8s-worker01 <none> <none>
nginx-proxy-k8s-worker02 1/1 Running 2 (78m ago) 56d 192.168.110.115 k8s-worker02 <none> <none>
현재 기본으로 사용중인 cgroup 버전 정보
root@k8s-worker02:~# stat -fc %T /sys/fs/cgroup/
cgroup2fs
cgroup 컨트롤러 확인
root@k8s-worker02:~# ll /sys/fs/cgroup/cgroup.controllers
-r--r--r-- 1 root root 0 Feb 23 05:13 /sys/fs/cgroup/cgroup.controllers
*20.04버전
root@k8s-master01:~# ll /sys/fs/cgroup/cgroup.controllers
ls: cannot access '/sys/fs/cgroup/cgroup.controllers': No such file or directory
[Ansible] Ubuntu Password 일괄 변경 (0) | 2023.03.21 |
---|---|
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
[CentOS7] Ansible 5.x 설치 (0) | 2023.02.09 |
[ubuntu] systemd에 관하여 (0) | 2022.10.24 |
[Linux] CentOS repository 구성 (0) | 2022.10.21 |
환경
CentOS 7.9 / Python 3.6.8 / Kubernetes 1.23.5 (kubespray release 2.19)
이슈
kubespray requirement.txt 에서 ansible==5.7.1을 요구하나, CentOS 7서 python3.8 이상부터 ansible 5.x를 지원
설치
[root@deploy ~]# yum install -y gcc zlib-devel openssl-devel libffi-devel
[root@deploy ~]# cd /opt
[root@deploy ~]# wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
[root@deploy ~]# tar -xvf Python-3.9.13.tgz
[root@deploy ~]# cd Python-3.9.13
[root@deploy ~]# ./configure --enable-optimizations --with-zlib --with-system-ffi
[root@deploy ~]# make altinstall
적용
[root@deploy ~]# which python3.9
/usr/local/bin/python3.9
[root@deploy ~]# cat /root/.bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi='vim'
alias python="/usr/local/bin/python3.9"
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
[root@deploy ~]# source /root/.bashrc
[root@deploy ~]# python --version
Python 3.9.13
# kubespray
[root@deploy ~]# python -m pip install virtualenv
[root@deploy ~]# python -m virtualenv venv
[root@deploy ~]# source venv/bin/activate
[root@deploy ~]# pip install -r requirements.txt
[Ubuntu] 20.04 커널버전 업그레이드 (0) | 2023.03.20 |
---|---|
[Ubuntu] 20.04 -> 22.04 업그레이드 (0) | 2023.02.24 |
[ubuntu] systemd에 관하여 (0) | 2022.10.24 |
[Linux] CentOS repository 구성 (0) | 2022.10.21 |
[Ubuntu] 특정 IP 차단/허용 (0) | 2022.10.13 |