Install Kubernetes VM Template

kubernetes vm template 생성 및 설치

  • 본 예에서는 ubuntu 22.04 를 base로 표준 image를 생성

  • ubuntu image repo: https://cloud-images.ubuntu.com/

  • create proxmox vm template: https://4sysops.com/archives/how-to-create-a-proxmox-vm-template/

# proxmox 서버 cli 
$ wget https://cloud-images.ubuntu.com/jammy/20230613/jammy-server-cloudimg-amd64.img
$ mv jammy-server-cloudimg-amd64.img jammy.qcow2 # qcow2로 변경
$ qemu-img info jellyfish.qcow2
$ qemu-img resize jellyfish.qcow2 32G  # disk size 32G로 변경
# 아래 a,b 작업 완료 후
$ qmset 100 --serial0 socket --vga serial0
$ qm importdisk 900 jammy.qcow2 proxmox
a. proxmox web gui로 vm 생성
b. CreateVM > General (node,vmid,name) > OS (Do not use any  media) >  System (Qemu Agent) > Hard Disk ( scsi device 제거) > CPU > Memory > Network > Confirm > 확인
proxmox web gui에서 방금 생성한 disk edit > add
900 > options > Boot Order scsi0 disk 1번 또는 2번으로 변경후 start

vm 필수 package 설치

  • ubuntu os daemon 관리 popup 창 제거

  • containerd 설치 (kubernetes 1.21 이후 버전부터 docker deprecated )

  • install runC

runC is an open-source container runtime for spawning and running containers on Linux according to the OCI specification.

  • containerd configuration for k8s

  • 기타 주요 os package 설치

  • local time 설정

  • aws client 설치

  • minio client 설치 (https://min.io/docs/minio/kubernetes/upstream/)

MinIO는 오픈소스로 제공되는 오브젝트 스토리지 서버이며 AWS S3와의 호환되는 클라우드 스토리지를 구축할 수 있다.

  • kubekey 설치 (https://kubesphere.io/docs/v3.4/installing-on-linux/introduction/kubekey/)

Go 로 개발된 kubekey는 Ansible 기반 설치 프로그램을 대체하는 새로운 설치 도구이며 kubernetes 또는 kubesphere를 모두 설치할 수 있다.

  • delete contents in /etc/machine-id

kubernetes cluster 설정 전 vm 요구 사항

  • vm은 master, worker (node1, node2, node3) 3개로 구성한다.

node spec

  • master node ssh key 생성 및 등록 (root 계정사용)

  • vm disk 구성 (root 계정사용)

proxmox gui에서 각 worker node에 2개의 disk를 할당한 상태

  • containerd 설정 변경 (worker node 만 해당)

install kubernetes cluster with kubekey

  • kubekey kubernetes cluster 생성을 위한 config 설정 (master node root 사용자)

  • spec.hosts.[] 부분을 준비된 vm에 맞게 조정

  • kubekey로 kubernetes cluster 생성

  • kubernetes 운영을 위한 bash cli 환경 설정

vi ~/.bashrc

  • kubesphere 설치

KubeSphere는 풀 스택 자동화 및 간소화된 DevOps 워크플로를 지원하는 멀티테넌트 엔터프라이즈급 컨테이너 플랫폼입니다.

kubernetes 주요 echo system 설치

  • openebs 설치 (CSI)

각 Kubernetes 노드에서 사용 가능한 스토리지를 관리하고 해당 스토리지를 사용 하여 Stateful 워크로드에 로컬 또는 분산 영구 볼륨을 제공한다

  • openebs memory leak 방지를 위해 data.node-disk-manager.config.filterconfigs[2].exclude 항목에 yaml 내용 추가

kubectl edit cm openebs-ndm-config -n openebs ()

openebs namespace 내에 openebs-ndm-* pod를 delete 한다.

  • metallb 설치 (https://metallb.universe.tf/)

Software로 Load Balancer 기능을 구현하여 Bare-metal Kubernetes cluster에서 Network Load Balancer 없이 Load Balancing 기능을 제공 하는 오픈소스 솔루션

  • NFS client provisioner

PersistentVolumeClaim 를 통해 기존에 구성된 NFS 서버에 Persistent Volume 를 자동으로 생성하는 도구

  • nginx install (https://www.nginx.com/)

Kubernetes 및 컨테이너화된 환경의 클라우드 네이티브 앱을 위한 트래픽 관리 솔루션

  • install cert-manager (https://cert-manager.io/)

Cert Manager는 K8s 내부에서 https 통신을 하기 위한 인증서를 생성하고 자동으로 갱신해주는 역할을 하는 모듈

aws access key secret object로 변환

DNS-01 clusterIssuer 생성

생성된 clusterissuer 로 certificate 요청

인증서 진행/확인 명령어

  • install kubed

Kubernetes Operator 로 ConfigMap 과 Secret 을 namespace 간에 동기화해주는 역할을 한다

클러스터 전역에서 사용할 Secrets/configMaps에 annotation 을 설정하고 사용할 namespace에 app=kubed를 적용하면 해당 namespace에 복제한다.

  • velero 설치 (https://velero.io/docs/main/)

Kubernetes 클러스터 자원과 Persistent Volume의 백업 및 복구 기능을 제공하는 오픈 소스

kubernetes에 설치

  • install istio

마이크로서비스 간 데이터 공유를 제어하는 기반을 제공하는 오픈소스 서비스 메쉬 플랫폼입니다. 여기에는 Istio를 모든 로깅 플랫폼, 텔레메트리 또는 정책 시스템으로 통합하도록 지원하는 API가 포함

  • install argocd

k8s 애플리케이션 배포 및 관리를 자동화하는 오픈소스 도구입니다. GitOps 방식을 지원하며, Git 리포지토리에 저장된 애플리케이션 코드와 kubernetes 리소스 정의 파일을 기반으로 배포를 수행

  • install gitlab

소프트웨어 개발 및 협업을 위한 올인원 솔루션을 제공하는 웹 기반 DevOps 플랫폼이다

Last updated