4 Commits

Author SHA1 Message Date
정훈 변
fcb0c2f1d4 Update README.md 2024-03-28 12:19:52 +09:00
정훈 변
3e5b87d5d0 내용 변경 2024-03-28 12:19:05 +09:00
정훈 변
a1839063d2 kube_vip 비활성화 2024-03-28 12:16:43 +09:00
정훈 변
a19987e12b Update README.md 2024-02-26 13:57:40 +09:00
30 changed files with 23 additions and 163 deletions

View File

@@ -1,89 +1,9 @@
# Offline Kubespray
## 개요
## 안내
`main` branch 같은 경우 테스트 및 업데이트를 위한 branch 입니다.<br>
반드시 최신 버전의 branch를 대상으로 `git clone` 하여서 사용하셔야 합니다.
( 현재 최신 버전 : ver2.24 )
현재 모든 고객사가 모두 각기 다른 Kubernetes 버전 , 다른 CNI , 다른 CRI 로 구성이 되어 있음.<br>
작년(2023년) Kubernetes 버전 1.18 및 Docker 로 구축을 한 환경이 존재함.<br>
(최신 버전의 Kubernetes는 1.28 / Docker는 공식적으로 Kubernetes에서 지원에서 제외 되었다)<br>
사실상 이해하기 어려운 구성의 환경들이 있는 관계로 최소한의 버전과 환경 통일을 위해 제작 되었음.<br>
최신 버전의 kubespray 2.24 기준으로 제작되었으며, kubernetes 버전 v1.28.6 을 지원하고 있음<br>
## 준비물
1.
2.
3. RHEL 8 계열 환경
- 고객 환경에서 일반적으로 대부분 RHEL 8 계열을 사용함에 따라 RHEL 8 계열로 패키징 하였음<br>
(redhat 8.6 / 8.8 / centos stream 8 테스트 완료)
- 추가적인 유지보수 , 버전 업 , 타OS 지원 예정 없음
- 필요 할 경우 제공된 offline kubespray 를 참고하여 엔지니어가 유동적으로 수정하여 사용
- 사용함에 있어서 오작동 혹은 사용법 문의는 언제든지 환영!
4. root 계정 혹은 root 권한을 가진 계정
5. offline kubespray 패키지
## 사용 방법
1. `ssh-keygen -t rsa` 커맨드를 사용하여 ssh key 생성 (마스터 노드 혹인 bastion 서버에서만 진행)
2. `ssh-copy-id user@ip` 커맨드를 사용하여 모든 master , worker 노드에 key를 등록 (마스터 노드 혹인 bastion 서버에서만 진행 - root 혹은 root 권한을 가진 계정)
3. `offline.tar.gz` 패키지를 다운 받아 서버로 옮긴다 (마스터 노드 혹인 bastion 서버)
4. `tar -zxvf offline.tar.gz` 커맨드를 사용하여 압축 해제
5. `cd offline` 커맨드로 `offline` 디렉토리 이동
6. `vi kubespray/inventory/exem/inventory.ini` 명령어로 `invetory.ini` 오픈
```yaml
[all]
hostname1 ansible_host=10.10.43.231 ip=10.10.43.231 etcd_member_name=hostname1 ansible_port=22
hostname2 ansible_host=10.10.43.232 ip=10.10.43.232 ansible_port=22
hostname3 ansible_host=10.10.43.233 ip=10.10.43.233 ansible_port=22
[kube_control_plane]
hostname1
[etcd]
hostname1
[kube_node]
hostname2
hostname3
[calico_rr]
[k8s_cluster:children]
kube_control_plane
kube_node
calico_rr
```
hostname1,2,3 , etcd_member_name 에 각각 사용할 서버들의 hostname을 입력<br>
ansible_host , ip 두 부분에 각 서버의 IP를 입력<br>
ansible_port 에 각 서버가 사용중인 ssh 포트 입력<br>
7. `./installer.sh` 커맨드로 `install.sh` 실행 후 1번 메뉴 실행
![](https://t25540965.p.clickup-attachments.com/t25540965/8ee2a07c-680f-4252-a768-a09a6d47e26a/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202023-12-15%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%203.25.42.png)
키보드의 화살표 ↑ , ↓ 키를 눌러서 메뉴 이동 및 엔터로 선택
자동으로 repo 구성 , python3.11 , rsync , ansible 설치
8. `./installer.sh` 커맨드로 [`install.sh`](http://install.sh) 실행 후 2번 메뉴 실행
![](https://t25540965.p.clickup-attachments.com/t25540965/d4a82573-68ab-49de-967b-da157cc7dabc/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202023-12-15%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%203.35.20.png)
httpd 를 마스터 노드에 설치 및 설정 ➝ local repo 생성
모든 노드는 해당 local repo에서(마스터 노드) 필요한 패키지를 다운로드 함
9. `./installer.sh` 커맨드로 [`install.sh`](http://install.sh/) 실행 후 3번 메뉴 실행
![](https://t25540965.p.clickup-attachments.com/t25540965/780d6dc6-8f90-4c42-a5e6-04374955b72f/%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202023-12-15%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%203.39.48.png)
local registry 생성 (master node에 container)
kubernetes 클러스터 생성
10. 따란-! Kubernetes v1.28.6 구성 완료---!!
## 사용 사례
1. SGI 서울보증보험 (CloudMOA Infra 구축)

View File

@@ -28,7 +28,7 @@ select_menu() {
do
printf "$ESC[2K$(check_selected $i $SELECTED) $i. ${!i}\n";
done
printf "\n$ESC[2KMake\n2024.04.19\n";
printf "\n$ESC[2KMake\n2023.12.15\n";
INPUT=$(input_key);
if [[ $INPUT = "" ]];
then break;

View File

@@ -36,7 +36,7 @@
## set "name": "url". insecure url must be started http://
## Port number is also needed if the default HTTPS port is not used.
containerd_insecure_registries:
"10.10.54.151:5000": "http://10.10.54.151:5000"
"10.10.54.200:5000": "http://10.10.54.200:5000"
# containerd_registries:

View File

@@ -11,7 +11,7 @@ files_repo: "http://{{ hostvars[groups['all'][0]]['ip'] }}"
# ubuntu_repo: "http://myinternalubunturepo"
## Container Registry overrides
github_image_repo: "{{ registry_host }}/ghcr.io"
github_image_repo: "{{ registry_host }}"
kube_image_repo: "{{ registry_host }}/registry.k8s.io"
gcr_image_repo: "{{ registry_host }}/gcr.io"
docker_image_repo: "{{ registry_host }}/docker.io"

View File

@@ -1,17 +1,23 @@
[all]
test-master ansible_host=10.10.54.151 ip=10.10.54.151 etcd_member_name=master ansible_port=22
test-worker1 ansible_host=10.10.54.152 ip=10.10.54.152 ansible_port=22
test-worker2 ansible_host=10.10.54.153 ip=10.10.54.153 ansible_port=22
master ansible_host=10.10.54.200 ip=10.10.54.200 etcd_member_name=master ansible_port=22
worker1 ansible_host=10.10.54.201 ip=10.10.54.201 ansible_port=22
worker2 ansible_host=10.10.54.202 ip=10.10.54.202 ansible_port=22
master2 ansible_host=10.10.54.203 ip=10.10.54.203 etcd_member_name=master2 ansible_port=22
master3 ansible_host=10.10.54.204 ip=10.10.54.204 etcd_member_name=master3 ansible_port=22
[kube_control_plane]
test-master
master
master2
master3
[etcd]
test-master
master
master2
master3
[kube_node]
test-worker1
test-worker2
worker1
worker2
[calico_rr]

View File

@@ -14,7 +14,7 @@
- { role: kubespray-defaults }
- { role: kubernetes/preinstall, tags: preinstall }
- { role: "container-engine", tags: "container-engine", when: deploy_container_engine }
# - { role: registry}
- { role: registry}
- { role: download, tags: download, when: "not skip_downloads" }
- name: Install etcd

View File

@@ -1 +0,0 @@
{"schemaVersion":2,"mediaType":"application/vnd.docker.distribution.manifest.list.v2+json","manifests":[{"mediaType":"application/vnd.docker.distribution.manifest.v2+json","digest":"sha256:fc2d39a0d6565db4bd6c94aa7b5efc2da67734cc97388afb5c72369a24bcfaea","size":1989,"platform":{"architecture":"amd64","os":"linux"}}]}

View File

@@ -1,51 +0,0 @@
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 16690,
"digest": "sha256:661daf9bcac824a4be78d50e09fdb7c5d3755e78295c71e1004385244c0c97b1"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 3401967,
"digest": "sha256:96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9e97021e7b4775d82bf6fa"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 1898484,
"digest": "sha256:4a0f59666a5fd450f2ce8d09ed4ebe43ffbd7aab57ea63cfeeda78813f70a8e2"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 628,
"digest": "sha256:9f5472f13101a5c107862581ec30d418ed6b7502d4bf47d3d9cc72d29ced54c3"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 958,
"digest": "sha256:a4c1563b8f0493c722ef582966b7671e51f08a6bb6c1735179e6bba4d3d982fd"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 370,
"digest": "sha256:7662ce3fbb6ddde8fceaff888cc5bca92d5d7648c28bde29d2945f4a8a6214ff"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 1214,
"digest": "sha256:d94270e5bff8364a9c3de98e4a7c5c8738c669d0f1f2175a4ccf61a48f34ad64"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 1403,
"digest": "sha256:f1a3f1328c13555b0fa6833ca510254c494d0b71983174d18ee40d2097e413a6"
},
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 12637059,
"digest": "sha256:a2860423d97a2f092001145d53a1b5a573ec0c623b768f43ad88596739226843"
}
]
}

View File

@@ -1 +0,0 @@
sha256:7fbd1848a3b784ba61d472dd8d703e45a4af6c5042d2528ac5775fa923384449