Kubernetes #4-3. Kubernetes 클러스터 구축 – worker node join (offline, 폐쇄망)

[Kubernetes #1. 사전작업 (offline, 폐쇄망)]
[Kubernetes #2-2. 사전작업 – 컨테이너 런타임 (offline, 폐쇄망)]
[Kubernetes #2-2. 사전작업 – docker 설정 (offline, 폐쇄망)]
[Kubernetes #3. Kubernetes 바이너리 설치 (offline, 폐쇄망)]
[Kubernetes #4. Kubernetes 클러스터 구축 – image pull (offline, 폐쇄망)]
[Kubernetes #4-2. Kubernetes 클러스터 구축 – 단일 마스터노드 생성 (offline, 폐쇄망)]
[Kubernetes #4-3. Kubernetes 클러스터 구축 – worker node join (offline, 폐쇄망)]

Worker node cluster join

Dockerkubernetes 구성 요소를 설치한 뒤 이전 포스트에서 cluster 초기화 시 생성된 스크립트를 실행하면 worker node로써 설정이 된다.

kubeadm join 192.168.4.78:6443 --token abcdefg.8rpr4mfmetbabcde --discovery-token-ca-cert-hash sha256:3a12345caaef12334567890cd3953d1234c3904ab70a8b949f32d6df12345

[preflight] Running pre-flight checks
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

worker 노드에서도 kubernetes config 관련 명령을 수행해주면 kubectl 명령을 이용할 수 있다.

kubectl get nodes

NAME       STATUS     ROLES                  AGE    VERSION
centos7    NotReady   control-plane,master   104s   v1.23.5
centos71   NotReady   <none>                 36s    v1.23.5

master node 설정 후 확인한 것과 같이 STAUS는 NotReady 상태로 표시된다. 이는 kubernetes 네트워크 관련 배포가 필요한 것으로 이후 관련 인스턴스를 배포하면 Ready 상태로 표시된다.

 

cluster 생성 후 24시간 경과 시

kubeadm init 수행 시 생성된 join 스크립트의 token은 24시간의 만료 시간을 가진다. 즉 24시간이 지나면 생성된 join script, 정확히 말하자면 token이 만료되어 사용이 불가능하다.

따라서 24시간 이후에는 갱신된 token을 확인하고 새 token을 이용한 join 스크립트를 사용해야 한다.

  • token 확인: TTL(Time To Live) 값을 보면 22h시간 사용가능함을 알 수 있다.
kubeadm token list
TOKEN                     TTL         EXPIRES                USAGES                   DESCRIPTION                                                EXTRA GROUPS
abcdef.2zha2oqwp12abcd1   22h         2022-04-08T00:46:45Z   authentication,signing   The default bootstrap token generated by 'kubeadm init'.   system:bootstrappers:kubeadm:default-node-token
  • 해당 token에 해당하는 sha256 값 확인
openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
871c73bfcb0d0421f029faa7ba07201abf4f00abcdefghijklmnopqrstuvwxyz
  • 확인된 token, 과 sha256 값을 이용하여 join 명령을 수행한다.
kubeadm join 192.168.4.78:6443 --token abcdef.2zha2oqwp12abcd1 --discovery-token-ca-cert-hash sha256:871c73bfcb0d0421f029faa7ba07201abf4f00abcdefghijklmnopqrstuvwxyz

 

 

 

Kubernetes #2-2. 사전작업 – docker 설정 (offline, 폐쇄망)

[Kubernetes #1. 사전작업 (offline, 폐쇄망)]
[Kubernetes #2-2. 사전작업 – 컨테이너 런타임 (offline, 폐쇄망)]
[Kubernetes #2-2. 사전작업 – docker 설정 (offline, 폐쇄망)]
[Kubernetes #3. Kubernetes 바이너리 설치 (offline, 폐쇄망)]
[Kubernetes #4. Kubernetes 클러스터 구축 – image pull (offline, 폐쇄망)]
[Kubernetes #4-2. Kubernetes 클러스터 구축 – 단일 마스터노드 생성 (offline, 폐쇄망)]
[Kubernetes #4-3. Kubernetes 클러스터 구축 – worker node join (offline, 폐쇄망)]

망분리 환경에서 proxy등을 통한 외부 연결이 가능하거나, 망 내부적으로 proxy를 통해 통신하는 경우 proxy 설정이 필요하다.
linux OS 레벨에서는 .bash_profile 등에 proxy 변수를 등록하는 것으로 처리가 가능하지만 docker 런타임은 별도로 proxy 정보를 정의해 줘야 한다

이 포스트의 작업은 쿠버네티스 클러스터에 포함하는 모든 노드에서 수행해야 한다.

     

Docker Proxy 설정

서비스 설정 (docker login 등의 작업 에 사용된다.)

[haedong@haedong:~:]$ sudo /lib/systemd/system/docker.service
전략...
# [service] 섹션에 아래 추가
Environment="HTTP_PROXY=http://120.121.122.123:8080" 
Environment="HTTPS_PROXY=https://120.121.122.123:8080" 
Environment="NO_PROXY=.haedong.net,localhost,127.0.0.1/8,192.168.0.0/16,.local" 
[haedong@haedong:~:]$ sudo systemctl daemon-reload
[haedong@haedong:~:]$ sudo systemctl restart docker.service

컨테이너 설행 시 변수로 전달

[haedong@haedong:~]$ docker run \
-e http_proxy=http://120.121.122.123:8080 \
-e https_proxy https://120.121.122.123:8080 \
-e no_proxy .haedong.net,localhost,127.0.0.1/8,192.168.0.0/16,.local \
CONTAINER_NAME

이미지 빌드 시 포함

ENV PATH /home/haedong/bin:$PATH
ENV LD_LIBRARY_PATH /lib:/lib64:$LD_LIBRARY_PATH
...중략...
# 아래 내용 추가
ENV http_proxy http://120.121.122.123:8080
ENV https_proxy https://120.121.122.123:8080
ENV no_proxy .haedong.net,localhost,127.0.0.1/8,192.168.0.0/16,.local

     

Docker root directory 변경

pull 한 image나 컨테이너 임시 데이터 등이 저장되는 디렉토리이다. 기본 값은 /var/lib/docker 인데, /var directory가 포함된 파티션의 크기가 작거나 하는 경우 disk full 로 인해 문제를 야기할 수 있다.

현재 docker root 확인

docker info | grep "Docker Root Dir" 

 Docker Root Dir: /var/lib/docker

#docker volume inspect my-vol

준비

docker root dirctory로 사용할 디스크를 확정하고 파티션 생성, 마운트 등의 작업을 마친다.
sudo systemctl stop docker.service 명령으로 서비스를 중지하고(시간이 걸릴 수 있다. 프로세스가 완전히 사라졌는지 확인하도록 하자) 이전의 docker 파일들을 대상 디렉토리로 복사한다.

mkdir /data
cp -rp /var/lib/docker /data

     

서비스 수정

sudo vi /usr/lib/systemd/system/docker.service
# Service 섹션에 ExecStart= 로 시작하는 줄을 수정한다.
# ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock --data-root=/data
sudo systemctl daemon-reload
sudo systemctl restart docker.service

     

cgroup driver 변경

현재 상태 확인

sudo docker info | grep cgroup
 Cgroup Driver: cgroupfs

서비스 수정

sudo vi /etc/systemd/system/docker.service

# ExecStart 로 시작하는 줄에  --exec-opt native.cgroupdriver=systemd 추가
# ExecStart=/usr/bin/dockerd -g /home/data/ -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -g /home/data/ -H fd:// --containerd=/run/containerd/containerd.sock --exec-opt native.cgroupdriver=systemd
sudo systemctl daemon-reload
sudo systemctl restart docker.service

Kubernetes #1. 사전작업 (offline, 폐쇄망)

[Kubernetes #1. 사전작업 (offline, 폐쇄망)]
[Kubernetes #2-2. 사전작업 – 컨테이너 런타임 (offline, 폐쇄망)]
[Kubernetes #2-2. 사전작업 – docker 설정 (offline, 폐쇄망)]
[Kubernetes #3. Kubernetes 바이너리 설치 (offline, 폐쇄망)]
[Kubernetes #4. Kubernetes 클러스터 구축 – image pull (offline, 폐쇄망)]
[Kubernetes #4-2. Kubernetes 클러스터 구축 – 단일 마스터노드 생성 (offline, 폐쇄망)]
[Kubernetes #4-3. Kubernetes 클러스터 구축 – worker node join (offline, 폐쇄망)]

쿠버네티스 공식 홈페이지의 가이드를 따르면 쉽게 설치할 수 있다.
하지만 경우에 따라 외부 연결이 불가능한 폐쇄망 등에 설치해야 하는 경우를 가정하여 설치하는 방법을 설명한다. (물론 이 방법도 쿠버네티스 공식 홈페이지에 잘 설명되어있다.)

기본적으로 쿠버네티스 클러스터는 노드간 통신에 별도의 네트워크를 사용한다.
(별도의 물리적 변경이 아닌 가상 환경) 이를 위해 브릿지 관련 설정을 변경한다.

이 포스트의 작업은 쿠버네티스 클러스터에 포함하는 모든 노드에서 수행해야 한다.

브릿지 네트워크 관련 설정 변경

[haedong@haedongg.net:~]$ sudo cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
[haedong@haedongg.net:~]$ sudo cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
[haedong@haedongg.net:~]$ sudo sysctl --system
[haedong@haedongg.net:~]$ sudo sysctl -p 
net.ipv4.tcp_keepalive_time = 160
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 2
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_syncookies = 1
vm.min_free_kbytes = 524288
...중략
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-arptables = 1
...생략

SELINUX 해제

[haedong@haedongg.net:~]$ vi /etc/selinux/config
...중략...
# 기본값은 SELINUX=enforced disabled로 수정한다.
SELINUX=disabled 
...생략

 

swap 메모리 해제

swap 여부 확인

[haedong@haedongg.net:~]$ free -g
              total        used        free      shared  buff/cache   available
Mem:             62           3           0           0          57          57
Swap:            99           0          99

swap 해제

[haedong@haedongg.net:~]$ swapoff -a

해제 확인

[haedong@haedongg.net:~]$ free -g
              total        used        free      shared  buff/cache   available
Mem:             62           3           0           0          57          57
Swap:             0           0           0

fstab 수정 ( swap 파티션이 마운트되지 않도록 설정)

[haedong@haedongg.net:~]$ sudo vi /etc/fstab
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=111f15c1-7697-4597-1234-b7f231009876 /boot                   xfs     defaults        0 0
#/dev/mapper/centos-home /home                   xfs     defaults        0 0
# 아래 줄을 주석처리 한다.
#/dev/mapper/centos-swap swap                    swap    defaults        0 0

 

hostname 과 hosts 파일 수정

쿠버네티스는 기본적으로 kubeadm init 시 hostname을 참조한다. 별도의 DNS를 사용하지 않는다면 /etc/hosts 파일에 호스트 명과 IP 정보를 적어준다.

[haedong@haedongg.net:~]$ vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

# 현재 서버의 정보가 없을 경우 다음 줄 추가 
192.168.192.168 haedongg.net

Kubesphere #1. 설치

Kubephere는 플러그앤 플레이 아키텍쳐를 통해 타사 애플리케이션을 해당 에코시스템에 원활하게 통합할 수 있는 kubernetes를 커널로 하는 클라우드 네이티브 애플리케이션 관리를 위한 분산 운영체제 이다.kubesphere 홈페이지 발췌

설치는 Kubesphere 홈페이지를 참고했다.

Kubesphere는 다음 Kubernetes 런타임을 지원한다.

Supported Container RuntimeVersion
Docker19.3.8 +
containerd (experimental, not fully tested)Latest
CRI-O (experimental, not fully tested)Latest
iSula (experimental, not fully tested)Latest

본 예제는 총 4대의 가상머신 (CentOS7, 4core CPU, 8GB RAM, 128GB storage)으로 테스트 하였다.

작업을 시작하기 전에 이 포스트를 참고하여 kubesphere 구성을 할 서버들 간의 SSH key를 맞춰주도록 한다.

의존성 패키지 설치
kubernetes v1.18 이상은 socat과 conntrack 패키지가 필요하고 ebtables와 ipset 패키지는 권장, v1.18 미만은 모두 설치를 권장한다.

haedong@haedong:~/kubesphere:]$ sudo yum install socat conntrack ebtables ipset
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
Package socat-1.7.3.2-2.el7.x86_64 already installed and latest version
...중략...
---> Package libnetfilter_queue.x86_64 0:1.0.2-2.el7_2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================================================================
 Package                                              Arch                                 Version                                       Repository                                  Size
==========================================================================================================================================================================================
Installing:
 conntrack-tools                                      x86_64                               1.4.4-7.el7                                   ...중략...
local_centos                                23 k
Transaction Summary
==========================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)
Total download size: 245 k
(4/4): libnetfilter_queue-1.0.2-2.el7_2.x86_64.rpm                                                                                                                 ...중략...
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                     1.6 MB/s | 245 kB  00:00:00
Running transaction check
...중략...
  Verifying  : libnetfilter_queue-1.0.2-2.el7_2.x86_64                                                                                                                                4/4
Installed:
  conntrack-tools.x86_64 0:1.4.4-7.el7
...중략...
Complete!

Kubesphere는 다음 port들을 사용한다. 본인 소유의 시스템이 아니라면 관리자에 다음 표의 포트 개방을 요청 해야 한다.

ServiceProtocolActionStart PortEnd PortNotes
sshTCPallow22
etcdTCPallow23792380
apiserverTCPallow6443
calicoTCPallow90999100
bgpTCPallow179
nodeportTCPallow3000032767
masterTCPallow1025010258
dnsTCPallow53
dnsUDPallow53
local-registryTCPallow5000For the offline environment
local-aptTCPallow5080For the offline environment
rpcbindTCPallow111Required if NFS is used
ipipIPENCAP / IPIPallowCalico needs to allow the ipip protocol
metrics-serverTCPallow8443

Kubekey 다운로드

haedong@kubesphere-01:~:]$ curl -ksfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
Downloading kubekey v1.1.1 from https://github.com/kubesphere/kubekey/releases/download/v1.1.1/kubekey-v1.1.1-linux-amd64.tar.gz ...
Failed to download Kubekey v1.1.1 !
Please verify the version you are trying to download.

잘 안된다…… github 릴리즈 페이지에서 다운로드 하자.

haedong@kubesphere-01:~:]$ wget --no-check-certificate https://github.com/kubesphere/kubekey/releases/download/v1.1.1/kubekey-v1.1.1-linux-amd64.tar.gz
--2021-08-25 14:53:24--  https://github.com/kubesphere/kubekey/releases/download/v1.1.1/kubekey-v1.1.1-linux-amd64.tar.gz
Connecting to 168.219.61.252:8080... connected.
...중략...
Length: 13341858 (13M) [application/octet-stream]
Saving to: ‘kubekey-v1.1.1-linux-amd64.tar.gz’

100%[================================================================================================================================================>] 13,341,858  3.14MB/s   in 4.4s

2021-08-25 14:53:30 (2.88 MB/s) - ‘kubekey-v1.1.1-linux-amd64.tar.gz’ saved [13341858/13341858]

압축을 해제하고 권한을 변경한다.

haedong@kubesphere-01:~:]$ tar -xvzf kubekey-v1.1.1-linux-amd64.tar.gz
README.md
README_zh-CN.md
kk
haedong@kubesphere-01:~:]$ chmod +x kk
haedong@kubesphere-01:~:]$ ll
합계 26428
-rw-r--r-- 1 haedong haedong    22906  7월 12 16:00 README.md
-rw-r--r-- 1 haedong haedong    22845  7월 12 16:00 README_zh-CN.md
-rwxr-xr-x 1 haedong haedong 13668116  7월 12 16:02 kk
-rw-rw-r-- 1 haedong haedong 13341858  7월 12 16:03 kubekey-v1.1.1-linux-amd64.tar.gz

설치
다운로드한 kk가 지원하는 kubernetes 버전을 확인한다. 1예제는 Kubekey를 이용해 Kubesphere와 Kubernetes를 함께 설치하는 방법을 나열한다. 기존에 설치되어있는 Kubernetes를 이용하는 경우는 여기를 눌러 설치 방법을 확인하면 된다.

haedong@kubesphere-01:~:]$ ./kk version --show-supported-k8s
v1.15.12
v1.16.8
v1.16.10
v1.16.12
v1.16.13
v1.17.0
v1.17.4
v1.17.5
v1.17.6
v1.17.7
v1.17.8
v1.17.9
v1.18.3
v1.18.5
v1.18.6
v1.18.8
v1.19.0
v1.19.8
v1.19.9
v1.20.4
v1.20.6

다음 템플릿대로 실행하면 된다
./kk create cluster [–with-kubernetes version] [–with-kubesphere version]

만약 부족한 패키지가 있다면 다음과 같이 표시될 것이다.

haedong@kubesphere-01:~:]$ sudo ./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
[sudo] haedong의 암호:
+---------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+
| name          | sudo | curl | openssl | ebtables | socat | ipset | conntrack | docker | nfs client | ceph client | glusterfs client | time         |
+---------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+
| kubesphere-01 | y    | y    | y       | y        |       | y     |           |        | y          |             |                  | KST 15:17:51 |
+---------------+------+------+---------+----------+-------+-------+-----------+--------+------------+-------------+------------------+--------------+
kubesphere-01: conntrack is required.

필요한 패키지가 모두 설치 되어있다면 다음과 같이 진행 된다.

haedong@kubesphere-01:~:]# sudo./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
+--------+------+------+---------+----------+-------+-------+-----------+---------+------------+-------------+------------------+---------                               -----+
| name   | sudo | curl | openssl | ebtables | socat | ipset | conntrack | docker  | nfs client | ceph client | glusterfs client | time                                        |
+--------+------+------+---------+----------+-------+-------+-----------+---------+------------+-------------+------------------+---------                               -----+
| kube01 | y    | y    | y       | y        | y     | y     | y         | 20.10.8 | y          |             |                  | KST 09:5                               2:43 |
+--------+------+------+---------+----------+-------+-------+-----------+---------+------------+-------------+------------------+---------                               -----+

This is a simple check of your environment.
Before installation, you should ensure that your machines meet all requirements specified at
https://github.com/kubesphere/kubekey#requirements-and-recommendations

Continue this installation? [yes/no]: yes
INFO[09:52:45 KST] Downloading Installation Files
INFO[09:52:45 KST] Downloading kubeadm ...
INFO[09:52:49 KST] Downloading kubelet ...
INFO[09:53:00 KST] Downloading kubectl ...
INFO[09:53:07 KST] Downloading helm ...
INFO[09:53:11 KST] Downloading kubecni ...
INFO[09:53:18 KST] Configuring operating system ...

...중략...

clusterconfiguration.installer.kubesphere.io/ks-installer created
#####################################################
###              Welcome to KubeSphere!           ###
#####################################################

Console: http://0.0.0.0:30880
Account: admin
Password: P@88w0rd

NOTES:
  1. After you log into the console, please check the
     monitoring status of service components in
     "Cluster Management". If any service is not
     ready, please wait patiently until all components
     are up and running.
  2. Please change the default password after login.

#####################################################
https://kubesphere.io             2021-09-07 10:00:00
#####################################################
INFO[10:00:11 KST] Installation is complete.

Please check the result using the command:

       kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

You have new mail in /var/spool/mail/root

kubekey를 이용한 설치 시 31개의 Docker image를 가져오게 되는데 운영 환경 제약 등으로 실패할 경우 아래 명령을 이용해 설치 전 이미지를 다운 받으면 된다.

docker pull docker.io/kubesphere/ks-installer:v3.1.1  &&\
docker pull docker.io/kubesphere/ks-controller-manager:v3.1.1  &&\
docker pull docker.io/kubesphere/ks-apiserver:v3.1.1  &&\
docker pull docker.io/kubesphere/ks-console:v3.1.1  &&\
docker pull docker.io/openebs/provisioner-localpv:2.10.1  &&\
docker pull docker.io/kubesphere/notification-manager:v1.0.0  &&\
docker pull docker.io/kubesphere/notification-manager-operator:v1.0.0  &&\
docker pull docker.io/openebs/linux-utils:2.10.0  &&\
docker pull docker.io/kubesphere/kubectl:v1.20.0 &&\
docker pull docker.io/prom/prometheus:v2.26.0 &&\
docker pull docker.io/kubesphere/kube-proxy:v1.20.4 &&\
docker pull docker.io/kubesphere/kube-apiserver:v1.20.4 &&\
docker pull docker.io/kubesphere/kube-controller-manager:v1.20.4 &&\
docker pull docker.io/kubesphere/kube-scheduler:v1.20.4 &&\
docker pull docker.io/csiplugin/snapshot-controller:v3.0.3  &&\
docker pull docker.io/kubesphere/kube-rbac-proxy:v0.8.0  &&\
docker pull docker.io/calico/node:v3.16.3 &&\
docker pull docker.io/calico/pod2daemon-flexvol:v3.16.3 &&\
docker pull docker.io/calico/cni:v3.16.3 &&\
docker pull docker.io/calico/kube-controllers:v3.16.3 &&\
docker pull docker.io/kubesphere/prometheus-config-reloader:v0.42.1 &&\
docker pull docker.io/kubesphere/prometheus-operator:v0.42.1 &&\
docker pull docker.io/kubesphere/etcd:v3.4.13 &&\
docker pull docker.io/prom/alertmanager:v0.21.0 &&\
docker pull docker.io/kubesphere/kube-state-metrics:v1.9.7  &&\
docker pull docker.io/kubesphere/k8s-dns-node-cache:1.15.12 &&\
docker pull docker.io/coredns/coredns:1.6.9   &&\
docker pull docker.io/kubesphere/pause:3.2     &&\
docker pull docker.io/jimmidyson/configmap-reload:v0.3.0  &&\
docker pull docker.io/prom/node-exporter:v0.18.1 &&\
docker pull docker.io/mirrorgooglecontainers/defaultbackend-amd64:1.4    

일반적인 환경에서는

haedong@kubesphere-01:~:]$ curl -ksfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -
haedong@kubesphere-01:~:]# sudo./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.1

위 두 줄 명령으로 설치가 진행되지만 특수한 환경에서는2 Proxy를 통한 외부 연결 등
Docker runtime 설치 -> Docker service 스크립트에 proxy 정보 추가 -> image pull -> 설치 의 순서로 진행해야 할 수 있다.

kubernetes #1. container runtime 설치

kubernetes1그리스어로 조타수(키잡이)를 의미한다.
오픈소스 기반의 컨테이너화 된 애플리케이션의 자동 디플로이, 스케일링 등을 제공하는 관리 시스템이다. 궁극적 목적은 여러 클러스터의 호스트 간 애플리케이션 컨테이너의 배치, 스케일링, 운영자동화 등을 위한 플랫폼 제공이다. 2위키백과 발췌

쿠버네티스 관리를 위한 도구이므로 쿠버네티스가 필요하다.

kubernetes 설치
https://dl.k8s.io/release/stable.txt에 최근 안정 버전 정보가 적혀있다.
글 작성일 기준으로 v1.22.1 이다. 아래 명령줄의 괄호 안 curl 명령을 v1.22.1로 치환해도 무방하다. (-k 옵션은 인증서 검증 생략 옵션이다.)

haedong@haedong:~:]$ curl -LO -k "https://dl.k8s.io/release/$(curl -L -s -k https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   154    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 44.7M  100 44.7M    0     0  4892k      0  0:00:09  0:00:09 --:--:-- 10.3M
또는
haedong@haedong:~:]$ curl -LO -k "https://dl.k8s.io/release/v1.22.1/bin/linux/amd64/kubectl"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   154    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 44.7M  100 44.7M    0     0  4004k      0  0:00:11  0:00:11 --:--:-- 6095k

다운로드한 파일 검증

haedong@haedong:~:]$ curl -LO "https://dl.k8s.io/$(curl -L -s   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0   154    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    64  100    64    0     0     52      0  0:00:01  0:00:01 --:--:--    52
haedong@haedong:~:]$ echo "$(<kubectl.sha256) kubectl" | sha256sum --check
kubectl: 성공

kubectl 설치

haedong@haedong:~:]$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
[sudo] haedong의 암호:
haedong@haedong:~:]$ ll /usr/local/bin/ | grep kubectl
-rwxr-xr-x 1 root root 46907392  8월 24 15:06 kubectl
haedong@haedong:~:]$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:45:37Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}

컨테이너 런타임 설치

containerd

haedong@haedong:~:]$ sudo vi /etc/modules-load.d/containerd.conf
# 아래 내용을 붙여 넣는다.
overlay
br_netfilter
haedong@haedong:~:]$ sudo modprobe overlay
haedong@haedong:~:]$ sudo modprobe br_netfilter
haedong@haedong:~:]$ sudo vi /etc/sysctl.d/99-kubernetes-cri.conf
# 아래 내용을 붙여 넣는다.
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
haedong@haedong:~:]$ sudo sysctl --system
* Applying /usr/lib/sysctl.d/00-system.conf ...
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
* Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
kernel.yama.ptrace_scope = 0
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
kernel.kptr_restrict = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/99-kubernetes-cri.conf ...
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
* Applying /etc/sysctl.d/99-sysctl.conf ...
net.ipv4.conf.all.arp_notify = 1
* Applying /etc/sysctl.conf ...
net.ipv4.conf.all.arp_notify = 1

설치

Centos-Base repository 활성화
기본적으로 활성화 되어있지만, local repository를 구축했거나, 비활성화 했다면 활성화 해야 한다.

haedong@haedong:~:]$ sudo vi /etc/yum.repos.d/bak/CentOS-Base.repo
# [extras] 꼭지의 enabled 값이 0이라면 1로 수정한다.
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


Docker 리포지터리 추가
rpm 파일들을 다운로드한 뒤 여기여기를 참고하여 로컬 리포지터리를 구축해도 된다.

haedong@haedong:~:]$ sudo sudo yum install -y yum-utils
haedong@haedong:~:]$ sudo sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

오래된 버전의 docker 관련 패키지 삭제

haedong@haedong:~:]$ sudo sudo sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

Docker engine 설치 3자세한 설치 관련 내용은 docker 홈페이지를 참고.

haedong@haedong:/home:]$ sudo yum install docker-ce docker-ce-cli containerd.io
Loaded plugins: fastestmirror
...중략...
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================================================================
 Package                                            Arch                            Version                                             Repository                                   Size
==========================================================================================================================================================================================
Installing:
 containerd.io                                      x86_64                          1.4.9-3.1.el7                                       docker                                       30 M
 docker-ce                                          x86_64                          3:20.10.8-3.el7                                     docker                                       23 M
 docker-ce-cli                                      x86_64                          1:20.10.8-3.el7                                     docker                                       29 M
...중략...
 slirp4netns                                        x86_64                          0.4.3-4.el7_8                                       local_centos-extra                           81 k
Transaction Summary
==========================================================================================================================================================================================
Install  3 Packages (+13 Dependent packages)
Total download size: 96 M
...중략...
(16/16): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                       | 620 kB  00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
...중략...
  Verifying  : libcgroup-0.41-21.el7.x86_64                                                                                                                                         16/16
Installed:
  containerd.io.x86_64 0:1.4.9-3.1.el7                           docker-ce.x86_64 3:20.10.8-3.el7                           docker-ce-cli.x86_64 1:20.10.8-3.el7
...중략...
Complete!

Docker 서비스 시작

haedong@haedong:/home:]$ sudo systemctl start docker.service

컨테이너 런타임 설치

containerd 설치

haedong@haedong:/home:]$ sudo mkdir -p /etc/containerd
haedong@haedong:/home:]$ containerd config default | sudo tee /etc/containerd/config.toml
version = 2
root = "/var/lib/containerd"
state = "/run/containerd"
plugin_dir = ""
disabled_plugins = []
required_plugins = []
oom_score = 0

[grpc]
  address = "/run/containerd/containerd.sock"
  tcp_address = ""
  tcp_tls_cert = ""
  tcp_tls_key = ""
  uid = 0
  gid = 0
  max_recv_message_size = 16777216
  max_send_message_size = 16777216

[ttrpc]
  address = ""
  uid = 0
  gid = 0

[debug]
  address = ""
  uid = 0
  gid = 0
  level = ""

[metrics]
  address = ""
  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 = "k8s.gcr.io/pause:3.2"
    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 = true
      discard_unpacked_layers = false
      [plugins."io.containerd.grpc.v1.cri".containerd.default_runtime]
        runtime_type = ""
        runtime_engine = ""
        runtime_root = ""
        privileged_without_host_devices = false
        base_runtime_spec = ""
      [plugins."io.containerd.grpc.v1.cri".containerd.untrusted_workload_runtime]
        runtime_type = ""
        runtime_engine = ""
        runtime_root = ""
        privileged_without_host_devices = false
        base_runtime_spec = ""
      [plugins."io.containerd.grpc.v1.cri".containerd.runtimes]
        [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
          runtime_type = "io.containerd.runc.v2"
          runtime_engine = ""
          runtime_root = ""
          privileged_without_host_devices = false
          base_runtime_spec = ""
          [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
    [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]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          endpoint = ["https://registry-1.docker.io"]
    [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.v1.linux"]
    shim = "containerd-shim"
    runtime = "runc"
    runtime_root = ""
    no_shim = false
    shim_debug = 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

CRI-O 설치

# .conf 파일을 만들어 부팅 시 모듈을 로드한다
haedong@haedong:/home:]$ cat <<EOF | sudo tee /etc/modules-load.d/crio.conf
> overlay
> br_netfilter
> EOF
haedong@haedong:/home:]$ sudo modprobe overlay
haedong@haedong:/home:]$ sudo modprobe br_netfilter
# 요구되는 sysctl 파라미터 설정, 이 설정은 재부팅 간에도 유지된다.
haedong@haedong:/home:]$ cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
> net.bridge.bridge-nf-call-iptables  = 1
> net.ipv4.ip_forward                 = 1
> net.bridge.bridge-nf-call-ip6tables = 1
> EOF
net.bridge.bridge-nf-call-iptables  = 1
net.ipv4.ip_forward                 = 1
net.bridge.bridge-nf-call-ip6tables = 1
haedong@haedong:/home:]$ sudo sysctl --system
* Applying /usr/lib/sysctl.d/00-system.conf ...
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
* Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
kernel.yama.ptrace_scope = 0
* Applying /usr/lib/sysctl.d/50-default.conf ...
kernel.sysrq = 16
kernel.core_uses_pid = 1
kernel.kptr_restrict = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.promote_secondaries = 1
net.ipv4.conf.all.promote_secondaries = 1
fs.protected_hardlinks = 1
fs.protected_symlinks = 1
* Applying /etc/sysctl.d/99-kubernetes-cri.conf ...
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
* Applying /etc/sysctl.d/99-sysctl.conf ...
net.ipv4.conf.all.arp_notify = 1
* Applying /etc/sysctl.conf ...
net.ipv4.conf.all.arp_notify = 1

환경변수 설정
/etc/profile 등에 기재해도 된다.

haedong@haedong:/home:]$ export OS=CentOS_7
haedong@haedong:/home:]$ echo $OS
CentOS_7

$VERSION 을 사용자의 쿠버네티스 버전과 일치하는 CRI-O 버전으로 설정한다. 이번 예시의 경우 v1.21.2이다. 4작성일 기준으로 kubuernetes는 1.22.1이었는데 CRI-O는 1.21.2까지 존재한다. 그래서 1.22.1 이 아니고 1.21.2

haedong@haedong:/home:]$ sudo curl -L -k -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/devel:kubic:libcontainers:stable.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
haedong@haedong:/home:]$ sudo curl -k -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/devel:kubic:libcontainers:stable:cri-o:$VERSION.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0

환경 탓인지 포스트를 작성하는 환경에서는 정상 동작을 하지 않는다.
안되면 다운받자. 여기에서 kubic_libcontainers repo 파일을 받거나 여기에 있는 rpm 파일들을 다운받아 yum을 이용해 설치, 여기에서 kubic_libcontainers repo 파일을 받거나 여기에 있는 rpm 파일들을 다운받고 yum으로 설치. 당연히 yum repository를 만들어놓고 사용해도 된다.

haedong@haedong:/home:]$ sudo yum -y install cri-o
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package cri-o.x86_64 0:1.21.2-4.2.el7 will be installed
...중략...
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================================================================================
 Package                                                      Arch                         Version                                        Repository                                 Size
==========================================================================================================================================================================================
Installing:
 cri-o                                                        x86_64                       1.21.2-4.2.el7                                 libcontainers_cri-o                        25 M
...중략...
Transaction Summary
==========================================================================================================================================================================================
Install  1 Package (+19 Dependent packages)
Total download size: 67 M
Installed size: 210 M
Downloading packages:
(1/20): conmon-2.0.29-1.el7.3.2.x86_64.rpm                                                                                                                         ...중략...
(20/20): containernetworking-plugins-1.0.0-0.2.rc1.el7.6.2.x86_64.rpm                                                                                              |  39 MB  00:00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                      83 MB/s |  67 MB  00:00:00
Running transaction check
...중략...
Installed:
  cri-o.x86_64 0:1.21.2-4.2.el7
...중략...
Complete!

CRI-O 시작
※ 다음 절에서 docker 데몬을 실행할 것이므로 서비스를 시작하지 않는다.

# 다음절에서 docker 데몬을 시작할 것이므로 수행하지 않는다.
haedong@haedong:/home:]$ sudo systemctl daemon-reload
haedong@haedong:/home:]$ sudo systemctl enable crio --now
Created symlink from /etc/systemd/system/multi-user.target.wants/crio.service to /usr/lib/systemd/system/crio.service.

cgroup 드라이버 설정

haedong@haedong:/home:]$ sudo vi /etc/crio/crio.conf
# [crio.runtime] 섹션에 아래 내용을 추가한다.
conmon_cgroup = "pod"
cgroup_manager = "cgroupfs"

Docker

컨테이너 cgroup 관리에 systemd를 사용하기 위한 docker 데몬 구성

haedong@haedong:/home:]$ sudo mkdir /etc/docker
haedong@haedong:/home:]$ cat <<EOF | sudo tee /etc/docker/daemon.json
> {
>   "exec-opts": ["native.cgroupdriver=systemd"],
>   "log-driver": "json-file",
>   "log-opts": {
>     "max-size": "100m"
>   },
>   "storage-driver": "overlay2"
> }
> EOF

docker 재시작 및 서비스 설정

haedong@haedong:/home:]$ sudo systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
haedong@haedong:/home:]$ sudo systemctl daemon-reload
haedong@haedong:/home:]$ sudo systemctl restart docker

Linux(CentOS7) 가상 네트워크 인터페이스 추가

NAT 구성 등을 위한 가상 인터페이스를 추가하는 방법을 설명알아보자.

인터페이스 정보 확인

[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.192.252  netmask 255.255.255.0  broadcast 192.168.192.255
        inet6 fe80::6d05:37d3:fb10:5b25  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:67:a4:a6  txqueuelen 1000  (Ethernet)
        RX packets 411  bytes 36267 (35.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 329  bytes 31013 (30.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 96  bytes 8376 (8.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 8376 (8.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

가상 인터페이스 생성
물리 인터페이스를 공유할 인터페이스 생성
ens33의 물리 NIC를 사용할 경우 ens33:0으로 생성한다.

[root@localhost ~]# cp /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-ens33:0              
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33:0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
# 인터페이스 명과 장치명이 겹치지 않도록 수정한다.
NAME=ens33:0
DEVICE=ens33:0
ONBOOT=yes

# 사용하고 싶은 IP로 변경한다.
IPADDR=192.168.192.253
PERFIX=24
GATEWAY=192.168.192.254

확인

[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.192.252  netmask 255.255.255.0  broadcast 192.168.192.255
        inet6 fe80::6d05:37d3:fb10:5b25  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:67:a4:a6  txqueuelen 1000  (Ethernet)
        RX packets 1046  bytes 93843 (91.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 703  bytes 78865 (77.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.192.253  netmask 255.255.255.0  broadcast 192.168.192.255
        ether 00:0c:29:67:a4:a6  txqueuelen 1000  (Ethernet)

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 104  bytes 9080 (8.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 104  bytes 9080 (8.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

인터페이스 정보를 확인하고 연결이 되는지 확인한다.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\haedong> ssh haedong@192.168.192.253
The authenticity of host '192.168.192.253 (192.168.192.253)' can't be established.
ECDSA key fingerprint is SHA256:en-----------------------0s3gUedMt8.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

Openstack #2-1 개념 아키텍쳐

Openstack #1 개요
Openstack #1-1 선행작업
Openstack #1-2 MariaDB(MySQL) 설치
Openstack #1-3 Chrony 설정
Openstack #1-4 MessageQueue(RabbitMQ)
Openstack #1-5 Memcached
Openstack #1-6 Etcd

openstack 모듈간 architecture 는 그림처럼 이해하면 쉽다.

하나의 가상 머신이 생성된다고 하면
– Novas는 Hypervisor로써 coumpute 노드로 설정된 노드들의 CPU와 RAM에 연결된다.
– Neutron은 네트워크 노드로 설정된 노드들의 네트워크 인터페이스와 연결된다.
– Cinder는 블록스토리지로 스토리지 노드들의 HDD(SSD 등)과 연결된다.
기본적으로 이 세 개의 모듈이 노드들의 자원을 획득하고 하나의 가상머신에 자원이 된다.

Glance와 Swift는 가상머신과 직접 연결되지 않는 것을 알 수 있는데 이는 Cinder와 달리 두 서비스는 가상머신에 가상디바이스를 직접 제공하지 않기 때문이다.

Horizon은 사용자가 openstack과 소통하기 위한 창구다. 웹 UI와 CLI를 제공한다.
Keystone은 사용자와 모듈을 식별한다.