Ubuntu에서 KubeSphere All-in-One 설치 가이드

1. KubeSphere 이해하기

KubeSphere는 Kubernetes 기반의 오픈소스 분산 운영체제로, 클라우드 네이티브 애플리케이션을 위한 완전한 기능을 제공합니다. 멀티 클러스터 관리, DevOps, 서비스 메시, 모니터링, 로깅 등 다양한 기능을 통합하여 제공하며, 플러그 앤 플레이 방식으로 서드파티 애플리케이션과 쉽게 통합됩니다.

초보자에게는 All-in-One 설치 모드가 가장 적합합니다. 이 모드는 KubeSphere와 Kubernetes를 최소한의 설정으로 빠르게 배포할 수 있게 해줍니다.

2. 시스템 요구사항

하드웨어 권장 사양

운영체제 최소 사양
Ubuntu 16.04, 18.04, 20.04, 22.04 2코어 CPU, 4GB RAM, 40GB 디스크
Debian Buster, Stretch 2코어 CPU, 4GB RAM, 40GB 디스크
CentOS 7.x 2코어 CPU, 4GB RAM, 40GB 디스크
RHEL 7 2코어 CPU, 4GB RAM, 40GB 디스크
SUSE Linux Enterprise Server 15 / openSUSE Leap 15.2 2코어 CPU, 4GB RAM, 40GB 디스크

테스트 환경 구성

호스트명 IP 주소 OS CPU RAM 디스크
master 192.168.43.128 CentOS 7.9 2 4GB 50GB
node1 192.168.43.129 CentOS 7.9 2 4GB 50GB
node2 192.168.43.130 CentOS 7.9 2 4GB 50GB

노드 요구사항

  • SSH를 통한 접속 가능
  • sudo, curl, openssl, tar 명령어 사용 가능

지원 컨테이너 런타임

런타임 버전
Docker 20.10.16
containerd 최신 버전

필수 의존성 패키지

패키지 Kubernetes ≥ 1.18 Kubernetes < 1.18
socat 필수 선택
conntrack 필수 선택
ebtables 선택 선택
ipset 선택 선택

3. 설치 과정

# 의존성 패키지 설치
yum install -y ebtables socat ipset conntrack

3.1 Docker 설치

# Docker 저장소 추가
yum install -y yum-utils
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast

# Docker 20.10.16 설치 (초기 저버전에서 --platform 이슈 발생, 아래 설명 참조)
yum -y install docker-ce-20.10.16-3.el7 docker-ce-cli-20.10.16

# Docker 서비스 시작 및 활성화
systemctl enable docker && systemctl start docker

# 레지스트리 미러 설정
cat > /etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://gqk8w9va.mirror.aliyuncs.com"]
}
EOF

# Docker 재시작
systemctl restart docker

# 설정 확인
docker info | grep "Registry Mirrors" -A 1</code>

3.2 Kubernetes 관련 설정

# Kubernetes 저장소 구성
cat > /etc/yum.repos.d/kubernetes.repo <<EOF
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
        http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

yum makecache fast

# kubelet과 kubectl 설치
yum install -y kubelet-1.17.9 kubectl-1.17.9</code>

4. KubeKey 다운로드

# 공식 저장소에서 KubeKey 클론
git clone https://github.com/kubesphere/kubekey.git

# 또는 스크립트로 다운로드
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -

# Kubernetes v1.22.12와 KubeSphere v3.3.2로 클러스터 생성
./kk create cluster --with-kubernetes v1.22.12 --with-kubesphere v3.3.2

# 설치 로그 확인
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l 'app in (ks-install, ks-installer)' -o jsonpath='{.items[0].metadata.name}') -f

# 웹 UI 접속: http://192.168.43.128:30880/

# 클러스터 삭제 (필요시)
./kk delete cluster

5. 문제 해결

./kk create cluster 명령 실행 중 다음과 같은 오류가 발생할 수 있습니다:

downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pause:3.5
12:22:47 UTC message: [master]
pull image failed: Failed to exec command: sudo -E /bin/bash -c "env PATH=$PATH docker pull registry.cn-beijing.aliyuncs.com/kubesphereio/pause:3.5 --platform amd64"
"--platform" is only supported on a Docker daemon with experimental features enabled: Process exited with status 1

이 오류는 Docker 버전이 낮아 --platform 옵션을 지원하지 않기 때문에 발생합니다. Docker 19.03.9 이상에서 --platform 옵션을 지원하므로, Docker를 20.10.16으로 업그레이드하여 문제를 해결했습니다.

참고: KubeSphere 공식 문서

태그: kubesphere kubernetes All-in-One linux CentOS

6월 29일 03:19에 게시됨