실습

Installing the Client Tools

CFSSL 설치

wget -q --timestamping \
https://storage.googleapis.com/kubernetes-the-hard-way/cfssl/1.4.1/linux/cfssl \
https://storage.googleapis.com/kubernetes-the-hard-way/cfssl/1.4.1/linux/cfssljson
chmod +x cfssl cfssljson
sudo mv cfssl cfssljson /usr/local/bin/

CFSSL 설치 확인

cfssl version

kubectl 설치

wget https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

kubectl 설치 확인

kubectl version --client

Provisioning Compute Resources

Networking

VPC

Subnet

Internet Gateway

Route Tables

Security Group

Network Load Balancer

Compute Instances

Instance Image

SSH Key Pair

Kubernetes Controllers

Kubernetes Workers

Provisioning a CA and Generating TLS Certificates

Certificate Authority

CA 설정파일 생성

CA 인증서 서명 요청(CSR) 생성

CA 인증서 생성

생성된 CA 인증서 정보 확인

Client and Server Certificates

The Admin Client Certificate

인증서 서명 요청(CSR) 생성

인증서 생성

The Kubelet Client Certificates

The Controller Manager Client Certificate

The Kube Proxy Client Certificate

The Scheduler Client Certificate

The Kubernetes API Server Certificate

The Service Account Key Pair

Distribute the Client and Server Certificates

Worker Instances

controller Instances

Generating Kubernetes Configuration Files for Authentication

Client Authentication Configs

Kubernetes Public IP Address

The kubelet Kubernetes Configuration File

The kube-proxy Kubernetes Configuration File

The kube-controller-manager Kubernetes Configuration File

The kube-scheduler Kubernetes Configuration File

The admin Kubernetes Configuration File

Distribute the Kubernetes Configuration Files

Worker Instances

Controller Instances

Generating the Data Encryption Config and Key

The Encryption Key

암호화 키 생성

The Encryption Config File

암호화 설정 파일 생성

컨트롤러 노드로 암호화 설정 파일 복사

Bootstrapping the etcd Cluster

Prerequisites

Bootstrapping an etcd Cluster Member

첫번째 인스턴스로 SSH 접속

Download and Install the etcd Binaries

ETCD 바이너리 다운로드

다운 받은 바이너리 설치

Configure the etcd Server

인증서 및 키파일 복사

EC2 사설 아이피를 환경변수로 저장

EC2 호스트 이름을 환경변수로 저장

ETCD systemd 설정 파일 생성

Start the etcd Server

나머지 두번째, 세번째 인스턴스에 위에 단계 반복

Verification

Bootstrapping the Kubernetes Control Plane

Prerequisites

첫번째 인스턴스로 SSH 접속

Provision the Kubernetes Control Plane

클러스터 설정 파일을 저장할 디렉토리 생성

Download and Install the Kubernetes Controller Binaries

쿠버네티스 바이너리 다운로드

쿠버네티스 바이너리 설치

Configure the Kubernetes API Server

EC2 사설 아이피를 환경변수로 저장

kube-apiserver.service systemd 설정 파일 생성

Configure the Kubernetes Controller Manager

kube-controller-manager kubeconfig 파일 복사

kube-controller-manager.service systemd 설정 파일 생성

Configure the Kubernetes Scheduler

kube-scheduler kubeconfig 파일 복사

kube-scheduler.yaml 설정 파일 생성

kube-scheduler.service systemd 설정 파일 생성

Start the Controller Services

API 서버 및 컨트롤러 실행 상태 확인

나머지 두번째, 세번째 인스턴스에 위에 단계 반복

Verification

Cloud9 인스턴스에서 아래 명령어를 실행해서 API 서버 상태 확인

RBAC for Kubelet Authorization

ClusterRole 생성

ClusterRoleBinding 생성

Bootstrapping the Kubernetes Worker Nodes

Prerequisites

첫번째 인스턴스로 SSH 접속

Provisioning a Kubernetes Worker Node

OS 라이브러리 설치

Download and Install Worker Binaries

바이너리를 설치할 디렉토리 생성

바이너리 설치

Configure CNI Networking

인스턴스 사용자 데이터에서 현재 인스턴스에 부여할 POD CIDR 확인

bridge 네트워크 설정 파일 생성

loopback 네트워크 설정 파일 생성

Configure containerd

containerd 설정 파일 생성

containerd.service systemd 설정 파일 생성

Configure the Kubelet

kubelet-config.yaml 설정 파일 생성

kubelet.service systemd 설정 파일 생성

Configure the Kubernetes Proxy

kube-proxy-config.yaml 설정 파일 생성

kube-proxy.service systemd 설정 파일 생성

Start the Worker Services

워커 노드 구성요소 실행 상태 확인

나머지 두번째, 세번째 인스턴스에 위에 단계 반복

Verification

Cloud9 인스턴스에서 아래 명령어를 실행해서 노드 목록 확인

Configuring kubectl for Remote Access

Verification

Provisioning Pod Network Routes

각 Worker 노드에 할당한 POD CIDR 대역대에 대한 라우팅 규칙 생성

Validate Routes

Deploying the DNS Cluster Add-on

The DNS Cluster Add-on

CoreDNS 배포

배포된 CoreDNS Pod 확인

Verification

busybox Deployment 생성

생성된 Pod 확인

생성된 Pod 안에서 DNS 쿼리 실행

Smoke Test

Data Encryption

Secret 생성

controller-1 에 SSH 접속

위에서 생성한 Secret 정보 확인

Deployments

NGINX Deployment 생성

생성된 Pod 확인

Port Forwarding

새로운 터미널을 열고 localhost 로 접속 시도

기존 터미널로 돌아와서 포트 포워딩 종료

Logs

Exec

Services

위에서 생성한 NGINX Deployment를 NodePort로 노출

NodePort 번호 확인

보안그룹에 인바운드 규칙 생성

접속 확인

Cleaning Up

Compute Instances

Networking

Last updated