티스토리 뷰
1. 서버노드 설치(1st node)
RKE2 설치를 위해 VM 3대를 준비합니다.
172.22.21.2x1:9345
172.22.21.2x2:9345
172.22.21.2x3:9345
2.1 스크립트 설치 및 서비스 시작
RKE2 provides an installation script that is a convenient way to install it as a service on systemd based systems.
hostname 에 special character (_) 등이 있으면, RKE2 서버 구동/설치에 문제가 있을 수 있음
#주의 : 마스터 3대모두 설치 하고 싶으면 아래 명령어 동시에 실행 하세요 !
$ swapoff -a (/etc/fstab swap comment out)
$ apt-get upgrade -y
$ apt-get dist-upgrade -y
$ apt-get update -y
$ systemctl stop ufw && ufw disable && iptables -F
RKE2 설치 :
$ curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="server" sh -
#주의 : 마스터 3대모두 설치 하고 싶으면 아래 명령어 동시에 실행 하세요 !
$ curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="server" sh -
[INFO] finding release for channel stable
[INFO] using v1.21.5+rke2r2 as release
[INFO] downloading checksums at https://github.com/rancher/rke2
/releases/download/v1.21.5+rke2r2/sha256sum-amd64.txt
[INFO] downloading tarball at https://github.com/rancher/rke2/releases
/download/v1.21.5+rke2r2/rke2.linux-amd64.tar.gz
[INFO] verifying tarball
[INFO] unpacking tarball file to /usr/local
$ systemctl enable rke2-server.service
2.2 CNI (Calico) Rancher 의 기본 CNI 는 Canal 이나 Calico 로 구축 권고
※ 향후 Tigera Solution Migration 을 위해 Calico CNI 로 설정하여, 구축권고 (다만, 2021/10/09일자 기준, Calio Cloud
에서 아직 RKE2 를 지원하지 않음)
Rancher provides the several CNI network providers for Kubernetes clusters:
Canal, Flannel, Calico and Weave. In Rancher, Canal is the default CNI network provider combined with Flannel and VXLAN encapsulation.
Rancher는 Kubernetes 클러스터를 위한 여러 CNI 네트워크 공급자를 제공합니다.
Canal, Flannel, Calico and Weave. Rancher에서 Canal은 Flannel 및 VXLAN 캡슐화와 결합된
기본 CNI 네트워크 공급자입니다.
$ mkdir -p /etc/rancher/rke2
$ vi /etc/rancher/rke2/config.yaml
cni: "calico"
# cni: "calico" <== 작성안하게 되면.. canal 로 지정됩니다.
※ SAN 설정 여기서는 SAN 예제 값으로, my-kubernetes-domain.com, another-kubernetes-domain.com 를
추가하는 것으로 진행
config.yaml 내부에 tls-san 입력 해도 되고 안해도 무관하긴 합니다.
# vi /etc/rancher/rke2/config.yaml
tls-san:
- my-kubernetes-domain.com
- another-kubernetes-domain.com
rke2-server 서비스 시작
systemctl start rke2-server.service
※ SAN 설정확인 SAN 값 추가 확인
(apiserver 인증서에 my-kubernetes-domain.com 과 another-kubernetes-domain.com 확인 가능),
인증서 저장 위치 : /var/lib /rancher/rke2/server/tls
참고URL : https://eff-certbot.readthedocs.io/en/stable/using.html#webroot
certbot certonly --webroot -w /var/www/example -d www.example.com -d example.com -w /var/www/other -d other.example.net -d another.other.example.net
#apt-get install certbot
무료 인증서를 아래와 같이 받아도 되고..
실제 존재하는 인증서가 있으시면 /var/lib/rancher/rke2/server/tls <- 이 곳 폴더에 생성하여 만들어 넣으셔도 됩니다.
$systemctl status rke2-server.service
# journalctl -u rke2-server -f
Jul 07 08:39:16 rke2-1 rke2[4327]: I0707 08:39:16.178631 4327 event.go:291]
"Event occurred" object="rke2-1" kind="Node" apiVersion="v1" type="
Normal" reason="Synced" message="Node synced successfully"
아래와 같이 실행 하면 됩니다.
#주의 : 마스터 3대모두 설치 하고 싶으면 아래 명령어 동시에 실행 하세요 !
mkdir ~/.kube/
cp /etc/rancher/rke2/rke2.yaml ~/.kube/config
export PATH=$PATH:/var/lib/rancher/rke2/bin/
echo 'export PATH=/usr/local/bin:/var/lib/rancher/rke2/bin:$PATH' >> ~/.bashrc
echo 'source <(kubectl completion bash)' >>~/.bashrc
echo 'alias k=kubectl' >>~/.bashrc
echo 'complete -F __start_kubectl k' >>~/.bashrc
source ~/.bashrc
# Server Token 확인방법
2.5 Server Token 확인
RKE2 가 설치된 서버에 Worker 노드나 추가 서버(Master 역할)시에 생성된 토근 값 필요.
Multiple RKE2 Server 노드에 node-token 같은 모두 동일함
$cat /var/lib/rancher/rke2/server/node-token
Calico 설치 여부 및 설정 확인!
(다만 저는 calico로 설치 하지 않았음)
kubectl get ns calico-system
kubectl get deploy -n calico-system
kubectl get ds -n calico-system
Node 확인~
$kubectl get nodes
NAME STATUS ROLES AGE VERSION
rke2 Ready control-plane,etcd,master 15m v1.20.7+rke2
2.7 2nd/3rd 서버 Node 추가
#주의 : 마스터 3대모두 설치 하고 싶으면 아래 명령어 동시에 실행 하세요 !
$ swapoff -a (/etc/fstab swap comment out)
$ apt-get upgrade -y
$ apt-get dist-upgrade -y
$ apt-get update -y
$ systemctl stop ufw && ufw disable && iptables -F
$ curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="server" sh -
$ systemctl enable rke2-server.service
$ mkdir -p /etc/rancher/rke2/
config.yaml 설정 시 필요한 토큰을 첫 번째 마스터 노드에서 확인
$ cat /var/lib/rancher/rke2/server/node-token
K10bb3a06960ea16375ed144cd8f5a8a98e7a5fc629b675021fa9447fc5daba8353::server:2f17234499ff71cd092f4d442fe900fb
# vi /etc/rancher/rke2/config.yaml
server: https://192.168.0.2:9345
token: K10bb3a06960ea16375ed144cd8f5a8a98e7a5fc629b675021fa9447fc5daba8353::server:2f17234499ff71cd092f4d442fe900fb
rke2-server 프로세스 구동 후, node 추가 확인 (5-10분소요)
$systemctl start rke2-server.service
journalctl -u rke2-server -f
$root@testvm-ymchoi2:/home/nshadmin# k get no
NAME STATUS ROLES AGE VERSION
testvm-ymchoi2 Ready control-plane,etcd,master 3h12m v1.24.10+rke2r1
testvm-ymchoi3 Ready control-plane,etcd,master 146m v1.24.10+rke2r1
tommypagy Ready control-plane,etcd,master 146m v1.24.10+rke2r1
Ingress-controller 설정 업데이트 3개의 RKE2 서버로 구성시에, replicaCount 를 설정하여, ingress 3개의 address 로 모두 설정되도록 적용. RKE2 v1.20 이하 버전의 경우. we want to have multiple replicas running for the rke2-ingress-nginx-controller and rke2-ingress-nginx-default-backend. To achieve this, create the following file: /var/lib/rancher/rke2/server/manifests/rke2-ingress-nginx-config.yaml
root@testvm-ymchoi2:/home/nshadmin# kubectl get ingress -A
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE
cattle-system rancher <none> 172.22.21.228.nip.io 172.22.21.228,172.22.21.229,172.22.21.230 80, 443 103m
root@testvm-ymchoi2:/home/nshadmin# kubectl get ingress -A
NAMESPACE NAME CLASS HOSTS ADDRESS PORTS AGE
cattle-system rancher <none> 172.22.21.228.nip.io 172.22.21.228,172.22.21.229,172.22.21.230 80, 443 119m
root@testvm-ymchoi2:/home/nshadmin# k get ds -n kube-sysbash: completion: function `__start_kubectl' not found
root@testvm-ymchoi2:/home/nshadmin# k get ds -n kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
rke2-canal 3 3 3 3 3 kubernetes.io/os=linux 3h2m
rke2-ingress-nginx-controller 3 3 3 3 3 kubernetes.io/os=linux 3h2m
Rancher 설치 방법!
Cert-Manager 설치
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.5.4/cert-manager.yaml
kubectl -n cert-manager rollout status deploy/cert-manager
kubectl -n cert-manager rollout status deploy/cert-manager-webhook
kubectl get pods --namespace cert-manager
HELM 설치
curl https://raw.githubusercontent.com/helm/helm/master/scripts/gethelm-3
helm version --client --short
Rancher UI 배포 ( cattle-system )
kubectl create namespace cattle-system
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
helm repo update
helm search repo rancher-stable
helm install rancher rancher-stable/rancher --namespace cattle-system --set hostname=172.22.21.2x1.nip.io --set replicas=1
# Rancher Server 접속해봅시다.
#부록 K9S 설치
curl -sL https://github.com/derailed/k9s/releases/download/v0.26.3/k9s_Linux_x86_64.tar.gz | tar xfz - -C /usr/local/bin k9s
#kubectx, kubens 설치 시 유용하게 사용됩니다.
sudo git clone https://github.com/ahmetb/kubectx /opt/kubectx
sudo ln -s /opt/kubectx/kubectx /usr/local/bin/kubectx
sudo ln -s /opt/kubectx/kubens /usr/local/bin/kubens
- Total
- Today
- Yesterday
- 스토리지 클레스
- 코로나19
- pod 상태
- 설치하기(HP-UX)
- 오라클 트러블 슈팅(성능 고도화 원리와 해법!)
- (InstantClient) 설치하기(HP-UX)
- [오라클 튜닝] sql 튜닝
- 테라폼
- 오라클 홈디렉토리 copy 후 startup 에러
- ubuntu
- 키알리
- Oracle
- 버쳐박스
- 앤시블
- [오라클 튜닝] instance 튜닝2
- 트리이스
- directory copy 후 startup 에러
- 튜닝
- CVE 취약점 점검
- startup 에러
- 오라클
- 여러서버 컨트롤
- 오라클 인스턴트클라이언트(InstantClient) 설치하기(HP-UX)
- 5.4.0.1072
- 쿠버네티스
- K8s
- MSA
- 커널
- ORACLE 트러블 슈팅(성능 고도화 원리와 해법!)
- 우분투
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |