콘텐츠로 이동

오프라인 배포

단일 노드 배포

주의

단일 노드 배포는 POC 환경에만 적합하며, 프로덕션 환경에는 적합하지 않습니다.

1. 전제 조건
1.1 sealos 사용 전제 조건
  • 호스트 이름을 설정할 수 있어야 하며, 호스트 이름에 밑줄(_)이 포함되지 않아야 합니다.
  • 노드 시간 동기화.
  • Kubernetes 클러스터의 첫 번째 노드에서 sealos run 명령을 실행합니다. 현재 클러스터 외부의 노드는 클러스터 설치를 지원하지 않습니다.
  • 클러스터 생성을 위해 깨끗한 운영체제를 사용하는 것을 권장합니다. Docker를 직접 설치하지 마세요.
  • 대부분의 Linux 배포판을 지원합니다(예: Ubuntu, CentOS, Rocky Linux).
  • 릴리스된 지원 Kubernetes 버전.
  • containerd를 컨테이너 런타임으로 사용하는 것을 지원합니다.
  • 퍼블릭 클라우드에서는 프라이빗 IP를 사용하세요.
2. 설치 및 배포
2.1 설치 패키지 구성

2.1.1 설치 패키지 다운로드

설치 패키지 주소: https://static.guance.com/dataflux/package/guance-middleware-arm64.tar.gz 설치 패키지 압축 해제:

tar -zvxf guance-middleware-arm64.tar.gz

설치 패키지 주소: https://static.guance.com/dataflux/package/guance-middleware-amd64.tar.gz 설치 패키지 압축 해제:

tar -zvxf guance-middleware-amd64.tar.gz

2.2 sealos 설치

2.2.1 sealos 설치

tar zxvf sealos_4.3.0_linux.tar.gz sealos && chmod +x sealos && mv sealos /usr/bin && sealos -h
sealos 자주 사용하는 명령어 요약
sealos save            클러스터 이미지를 파일로 저장
sealos load            파일에서 클러스터 이미지 로드
sealos images          이미지 목록 조회
sealos rmi             로컬 이미지 삭제
sealos run imageId     이미지 기반으로 애플리케이션 실행
sealos version         sealos 버전 확인
sealos help            sealos 도움말 문서

2.3 Kubernetes 클러스터 설치

2.3.1 Kubernetes 설치

sealos load -i calico_3.22.1.tar.gz && sealos load -i helm_3.8.2.tar.gz && sealos load -i kubernetes_1.24.0.tar.gz && sealos images

sealos run pubrepo.guance.com/googleimages/kubernetes:v1.24.0 pubrepo.guance.com/googleimages/helm:v3.8.2 pubrepo.guance.com/googleimages/calico:v3.22.1 --single

# 확인
kubectl get nodes 

2.3.2 containerd 데이터 디렉터리 변경

containerd의 기본 데이터 디렉터리는 / 아래에 있습니다. Kubernetes 1.16 이상 버전에서는 기본 루트 디렉터리 사용률이 85%에 도달하면 노드의 파드가 축출됩니다. 파드 축출을 방지하려면 containerd 데이터 디렉터리를 데이터 디스크로 변경해야 합니다.

# 모든 노드가 Ready 상태가 된 후 containerd 데이터 디렉터리 변경
vim /etc/containerd/config.toml
root = "/data/containerd"
mkdir -p /data/containerd
cp -r /var/lib/containerd/* /data/containerd
chmod 777 -R /data/containerd
# containerd 재시작
sudo systemctl restart containerd

2.4 NFS 설치

2.4.1 방화벽 비활성화

CentOS 비활성화 명령어

systemctl stop firewalld
systemctl disable firewalld

Ubuntu 비활성화 명령어

sudo systemctl stop ufw.service
sudo systemctl disable ufw.service

2.4.2 nfs 서비스 설치

서버가 외부 네트워크에 접근 가능한 경우 다음 명령어로 nfs를 배포할 수 있습니다.

CentOS 설치 명령어

yum install rpcbind nfs-utils -y

Ubuntu 설치 명령어

apt-get install nfs-kernel-server -y

서버가 외부 네트워크에 접근 불가능한 경우, 압축 해제된 파일에서 nfs-package 폴더를 찾아 해당 버전의 오프라인 패키지를 찾아 다음 명령어로 설치합니다.

CentOS 오프라인 설치 명령어

tar -zvxf nfs-utils.tar.gz
cd nfs-utils
rpm -Uvh *.rpm --nodeps --force

Ubuntu 오프라인 설치 명령어

tar -zvxf nfs-utils.tar.gz
cd nfs-utils
sudo dpkg -i *.deb    

2.4.3 nfs 공유 경로 구성

공유 디렉터리 생성

mkdir /nfsdata
vim /etc/exports 명령을 실행하여 exports 파일을 생성하고, 파일 내용은 다음과 같습니다.

#/nfsdata *(insecure,rw,async,no_root_squash)
/nfsdata *(rw,no_root_squash,no_all_squash,insecure) 

참고: /nfsdata 디렉터리는 nfs용으로 구성된 공유 디렉터리입니다. 이 디렉터리는 일반적으로 별도로 마운트된 데이터 디스크(예: /data/nfsdata)에 위치합니다.

2.4.4 nfs 서비스 시작

다음 명령어를 실행하여 nfs 서비스를 시작합니다.

CentOS 시작 명령어

systemctl enable rpcbind
systemctl enable nfs-server
systemctl restart rpcbind
systemctl restart nfs-server

Ubuntu 시작 명령어

service nfs-kernel-server start   

2.4.5 구성 확인

showmount -e localhost
2.5 Kubernetes Storage 설치

2.5.1 Kubernetes Storage 설치

sealos load -i nfs_4.0.2.tar.gz
# nfs 클러스터 이미지의 imageId 가져오기
sealos images
# 가져온 클러스터 이미지 id로 아래 imagesId 값 대체
sealos run imagesId -e nfs_server=192.168.0.41,nfs_path=/nfsdata

참고: 아래 다른 컴포넌트의 imageId도 동일한 방식으로 가져와서 대체할 수 있습니다.

파라미터 설명:

Name Description Value
nfs_server 서버 IP 예: 192.168.3.143
nfs_path nfs 공유 경로 예: /data/nfsdata
2.6 Ingress 설치

2.6.1 Ingress 설치

sealos load -i ingress_1.3.0.tar.gz
sealos run imagesId

참고: 도메인이 서버에 직접 연결되어 있는 경우, ingress deployment에 hostNetwork: true 설정을 추가할 수 있습니다.

2.7 OpenEBS 설치

2.7.1 OpenEBS 설치

sealos load -i localpv-provisioner_3.3.0.tar.gz
sealos run imagesId

참고: openebs 설치는 선택 사항입니다. 로컬 스토리지를 사용하며 nfs보다 성능이 우수합니다.

2.8 middleware 네임스페이스 생성

2.8.1 middleware 네임스페이스 생성

kubectl create ns middleware
2.9 MySQL 설치

2.9.1 MySQL 설치

sealos로 mysql 설치

sealos load -i mysql_8.0.tar.gz 
# 예제 1: 디스크 유형이 nfs이고 storageclass 이름이 df-nfs-storage인 배포 명령어
sealos run imageId -e storageclass_type=nfs,openebs_localpath='',nfs_name=df-nfs-storage
# 예제 2: 디스크 유형이 openebs이고 로컬 공유 경로가 /data/mysql_data인 배포 명령어
sealos run imageId -e storageclass_type=openebs,openebs_localpath='/data/mysql_data',nfs_name=''

파라미터 설명:

Name Description Value
storageclass_type 사용할 SC 유형, nfs 또는 openebs 선택 가능 nfs 또는 openebs (필수)
openebs_localpath SC 유형이 openebs인 경우에만 로컬 경로 지정 필요 예: /data/mysql_data SC 유형이 openebs인 경우 필수
nfs_name SC 유형이 nfs인 경우, PVC가 바인딩할 storageclass 이름 설정 예: df-nfs-storage SC 유형이 nfs인 경우 필수

2.9.2 MySQL 구성 사용자 생성

# guance_setup_user 생성
kubectl -n middleware exec -it podname bash
# 비밀번호 입력: rootPassw0rd
mysql -uroot -p 
create user 'guance_setup_user'@'%' identified by 'Aa123456';
-- WITH GRANT OPTION:  옵션은 해당 사용자가 자신이 가진 권한을 다른 사용자에게 부여할  있음을 의미합니다.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, LOCK TABLES, CREATE TEMPORARY TABLES, TRIGGER, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, GRANT OPTION, PROCESS, REFERENCES, RELOAD,  CREATE USER, USAGE on *.* TO 'guance_setup_user'@'%' with GRANT OPTION;
FLUSH PRIVILEGES;

# 연결 정보
연결 주소: mysql.middleware
포트: 3306
사용자: guance_setup_user
비밀번호: Aa123456
2.10 OpenSearch 설치

2.10.1 OpenSearch 설치

sealos load -i opensearch_2.3.0.tar.gz
sealos run imagesId -e nfs_name=df-nfs-storage

참고: opensearch 디스크 유형은 현재 nfs만 지원합니다.

파라미터 설명:

Name Description Value
nfs_name SC 유형이 nfs인 경우, PVC가 바인딩할 storageclass 이름 설정 예: df-nfs-storage (필수)

2.10.2 opensearch 기본 비밀번호 변경

# 비밀번호 변경
kubectl exec -ti -n middleware opensearch-single-0 -- curl -u admin:admin \
       -XPUT "http://localhost:9200/_plugins/_security/api/internalusers/elastic" \
       -H 'Content-Type: application/json' \
       -d '{
            "password": "4dIv4VJQG5t5dcJOL8R5",
            "opendistro_security_roles": ["all_access"]
        }'


# 연결 정보
연결 주소: opensearch-single.middleware
포트: 9200
사용자: elastic
비밀번호: 4dIv4VJQG5t5dcJOL8R5
2.11 GuanceDB 설치

2.11.1 GuanceDB 설치

sealos load -i guancedb.tar.gz
sealos run imagesId -e nfs_name=df-nfs-storage

참고: GuanceDB 디스크 유형은 현재 nfs만 지원합니다.

파라미터 설명:

Name Description Value
nfs_name SC 유형이 nfs인 경우, PVC가 바인딩할 storageclass 이름 설정 예: df-nfs-storage (필수)
2.12 launcher 배포

2.12.1 비즈니스 서비스 설치 패키지 다운로드

이미지 패키지 다운로드 주소: https://static.guance.com/dataflux/package/guance-arm64-latest.tar.gz

이미지 패키지 다운로드 주소: https://static.guance.com/dataflux/package/guance-amd64-latest.tar.gz

2.12.2 launcher chart 패키지 다운로드

chart 패키지 다운로드 주소: https://static.guance.com/dataflux/package/launcher-helm-latest.tgz

2.12.3 비즈니스 서비스 이미지 가져오기

# containerd 환경에서 가져오기
gunzip guance-amd64-latest.tar.gz
ctr -n=k8s.io images import guance-amd64-latest.tar

2.12.4 launcher 설치

helm install launcher launcher-*.tgz -n launcher --create-namespace  \
  --set ingress.hostName=launcher.dataflux.cn \
  --set storageClassName=df-nfs-storage

2.12.5 비즈니스 서비스 단일 복제본 구성(선택 사항)

POC 환경에서 단일 복제본만 사용하려는 경우 다음과 같이 구성할 수 있습니다.

kubectl edit cm launcher-settings -n launcher
# 다음 설정 추가
settings.yaml: 'debug: True'
# 추가 완료 후 launcher 서비스 재시작
kubectl -n launcher rollout restart deploy launcher

2.12.6 launcher 접속

# ingress의 network 방식 변경, ingress deployment 수정 후 추가
hostNetwork: true
# 수정 완료 후 로컬 호스트 설정, 8.130.126.215는 서버 IP이며 외부에 80 포트를 개방해야 함
8.130.126.215 launcher.dataflux.cn
2.13 launcher를 통한 비즈니스 서비스 배포

launcher 배포가 완료되면 설치 시작 문서를 참고하여 비즈니스 서비스를 배포할 수 있습니다.

문서 평가

이 페이지가 도움이 되었나요?