Hyperledger Fabric
on Kubernetes
Kubernetes ?
2
• 컨테이너 오케스트레이터 (실행 및 관리)
• 다양한 클라우드 및 베어 메탈 환경 지원
• Google Borg에서 시작되어 오픈소스화 됨
• 100% Go 언어로 작성
• 2015년 7월 V1.0이 CNCF
( Cloud Native Computing Foundation )에 기부
• 2018년 3월 6일 CNCF에서 졸업한 첫 번째 프로젝트
Kubernetes is an open-source system for automating deployment, scaling, and
management of containerized applications. https://kubernetes.io/
Container Orchestration Functionality
3
• 스케쥴링
• Cluster 관리
• Service Discovery
• 모니터링
• 설정
• ...
Container Orchestration Player
4
Layer 1 Raw Compute, Storage, Network
Layer 2 vSphere, EC2, GCP, Azure, OpenStack
Layer 3 Ubuntu, RHEL, CoreOS, Unikernels
Layer 4 Docker, rkt, runC (OCI), Osv, LXC, LXD
Layer 5 Kubernetes, Docker Swarm, Marathon/Mesos, Nomad, Diego
Physical Infrastructure
Virtual Infrastructure
Operating System
Container Engine
Orchestration/Scheduling
Service Model
Development Workflow
Opinionated Containers
Layer 6
Source : https://www.mendix.com/blog/new-mendix-support-kubernetes-brings-choice-control/
OpenShift, Cloud Foundry, Docker Cloud, Deis, Apcera, Apprenda
K8S 특징
5
• Automatic binpacking
• Self-healing
• Horizontal scaling
• Service discovery and Load balancing
• Automatic rollouts and rollbacks
• Secret and configuration management
• Storage orchestration
• Batch execution
Kubernetes 구성
6
API
UI
CLI
Kubernetes
Cluster
Control Plane
(Master)
Kubernetes
Node 1
Kubernetes
Node 2
..
Kubernetes
Node N
Registry
• API Server
• Controller Manager Server
• Scheduler Server
• etcd
• kubectl
Cluster control plane
7
• Kubernetes Master
• kube-apiserver
• kube-scheduler
• kube-controller-manager
• cloud-controller-manager
• etcd
Master components
Colocated, or spread across machines,
as dictated by cluster size
Kubernetes Cluster Control Plane
8
Kubernetes
Master Node
Schedulers
REST
(pods, services,
rep. controllers)
scheduling
actuator
Schedulers
Controller managers
(replication controller etc)
kubectl (user commands)
APIs Kubernetes
Node
Kubernetes
Node
Distributed
Watchable
Storages
( Implemented via etcd )
authentication
authorization
Kubernetes Node
9
• Worker
• Container Runtime
• kubelet
• kube-proxy
• cAdvisor
Kubernetes Node
10
Kubernetes Worker Node
Kube Proxykubelet
Ingress Controller
Docker
Kubernetes
Master
Pod
container
container
container
Pod
container
container
container
Pod
container
container
cAdvisor ...
Internet
Kubernetes Object Model
11
• kube-apiserver를 통해 Kubernetes object 생성/관리
Kubernetes Object API version
12
• Alpha  Beta  Stable
• apps/v1alpha
• apps/v1alpha2
• apps/v1beta
• apps/v1beta2
• ...
• apps/v1
Kubernetes Objects
13
• Basic objects
• Pod
• Service
• Volume
• Namespace
• Controllers
• ReplicaSet
• ReplicationController
• Deployment
• StatefulSets
• DaemonSet
• Garbage Collection
• Jobs
• CronJob
14
Datacenter 1
관리서버 개발서버 운영서버
Datacenter 2
관리서버 개발서버 운영서버
Datacenter 3
관리서버 개발서버 운영서버
SPINE SPINE SPINE SPINE SPINE SPINE
Fabric Fabric
Cloud Leaf
Cloud Leaf
Mgmt Switch
관리서버
관리서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
개발/테스트 서버
개발/테스트 서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
운영서버
운영서버
운영서버
운영서버
운영서버
운영서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
관리서버
관리서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
개발테스트 서버
개발/테스트 서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
운영서버
운영서버
운영서버
운영서버
운영서버
운영서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
관리서버
관리서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
개발/테스트 서버
개발/테스트 서버
Cloud Leaf
Cloud Leaf
Mgmt Switch
운영서버
운영서버
운영서버
운영서버
운영서버
운영서버
Docker network
15
host
container network
host network
docker0
veth
eth0: 172.17.0.2
container
eth0: 172.17.0.3
container
eth0: 172.17.0.4
container
eth0: 192.168.0.2
Docker network on multi host
16
host
container network
host
networkdocker0
veth
eth0:
172.17.0.2
container
eth0:
172.17.0.3
container
eth0:
172.17.0.4
container
eth0:
192.168.0.2
host
container network
host
networkdocker0
veth
eth0:
172.17.0.2
container
eth0:
172.17.0.3
container
eth0:
172.17.0.4
container
eth0:
192.168.0.3
host
container network
host
networkdocker0
veth
eth0:
172.17.0.2
container
eth0:
172.17.0.3
container
eth0:
172.17.0.4
container
eth0:
192.168.0.4
Docker network on multi host
17
host
container network
host
networkdocker0
veth
eth0:
172.17.0.2
container
eth0:
172.17.0.3
container
eth0:
172.17.0.4
container
eth0:
192.168.0.2
host
container network
host
networkdocker0
veth
eth0:
172.17.0.2
container
eth0:
172.17.0.3
container
eth0:
172.17.0.4
container
eth0:
192.168.0.3
host
container network
host
networkdocker0
veth
eth0:
172.17.0.2
container
eth0:
172.17.0.3
container
eth0:
172.17.0.4
container
eth0:
192.168.0.4
overlay network
Kubernetes Architecture example
18
K8S 클러스터
Master Node
API Server
Scheduler
Controller
Manager
kubectl
사용자
어드민/운영
자/개발자
etcd
Monitoring/Logging/Alert
Prometheus
Alert manager
Logstash
Elasticsearch
Grafana Kibana
Overlay network
Worker Node Worker Node Worker Node
Kube Proxy Kube Proxy Kube Proxy
POD
cAdvisor
POD POD
NodeJS POD Nginx
cAdvisorPOD
cAdvisor
Web
socket
Kubelet Kubelet Kubelet
Redis
Prometheu
s sidecar
Scheduler
19
• Resource based scheduling
limit
reservation
usage
Scheduler는 POD가 어떤 Node에 배치될지 결정 함
Node
2GB
2Core
Kubelet
+ cAdvisor
disktype = ssd
Labels
Resources
Disks
• nodeSelector or nodeAffinity based
scheduling
Controller-manager
20
• Node Controller:
- 노드의 상태 체크
• Replication Controller:
- 모든 POD가 지정된 갯수 만큼 구동되게 유지
• Endpoints Controller:
- Endpoint 객체 관리 ( Service 와 POD )
• Service Account & Token Controllers:
- 새로운 네임스페이스에 대한 기본 계정 및 API 접속 토큰 발행
Service discovery
21
• POD는 Kubernetes Master의 Scheduler에 의해서 배치되고 관리됨
• POD는 고정된 접속 정보 없이 언제든지 클러스터내 서버 들에서 이동 가능함
• POD에 요청을 하기 위한 메커니즘이 필요
Node
Pod 1
labels: app=MyApp
port: 9376
Pod 2
labels: app=MyApp
port: 9376
Pod 3
labels: app=MyApp
port: 9376
kube-proxy
Client
ServiceIP
(iptables)
apiserver
Node 1 Node 2 Node 3
S1 S2 S3 S4
Service Type
• ClusterIP : 클러스터 내부에서만 사용 가능한 주소 (외부에서 호출 불가)
• NodePort: 서비스 생성시 만들어진 포트로 접속가능 (클러스터의 NodeIP:NortPort)
• LoadBalancer : 외부 loadbalancer에 의해 접속 가능한 주소
 Kubernetes Service
POD의 논리적 집합과 접속 할 수 있는 정책(Policy)이 정의되어 있는 객체
Kubernetes 가치
22
• 전계층 가용성
• 데이터센터, 서버, 네트워크 스토리지 장애에 영향 없는 무중단 서비스 구현
• 계층별 오류/고장에 대한 Fault Tolerant 방법 확인
• 워크로드 이식성
• 특정 데이터 센터, H/W에 종속되지 않는 어플리케이션 실행
• 동적 물리 서버 자원 증설하여 용량 확대
• 자동화 (수작업 최소화)
• 서비스 중지 없이 변경사항 적용 자동화
• 어플리케이션 배포 중 무중단 서비스 제공
• 어플리케이션 독립성
• 외부 부하(CPU, 네트워크)에 영향 받지 않는 실행환경 독립성 검증
• 서비스 탄력성
• CPU 사용률, 응담시간등의 정책에 의한 동적 스케일링

[2019.04] 쿠버네티스 기반 하이퍼레저 패브릭 네트워크 구축하기

  • 1.
  • 2.
    Kubernetes ? 2 • 컨테이너오케스트레이터 (실행 및 관리) • 다양한 클라우드 및 베어 메탈 환경 지원 • Google Borg에서 시작되어 오픈소스화 됨 • 100% Go 언어로 작성 • 2015년 7월 V1.0이 CNCF ( Cloud Native Computing Foundation )에 기부 • 2018년 3월 6일 CNCF에서 졸업한 첫 번째 프로젝트 Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. https://kubernetes.io/
  • 3.
    Container Orchestration Functionality 3 •스케쥴링 • Cluster 관리 • Service Discovery • 모니터링 • 설정 • ...
  • 4.
    Container Orchestration Player 4 Layer1 Raw Compute, Storage, Network Layer 2 vSphere, EC2, GCP, Azure, OpenStack Layer 3 Ubuntu, RHEL, CoreOS, Unikernels Layer 4 Docker, rkt, runC (OCI), Osv, LXC, LXD Layer 5 Kubernetes, Docker Swarm, Marathon/Mesos, Nomad, Diego Physical Infrastructure Virtual Infrastructure Operating System Container Engine Orchestration/Scheduling Service Model Development Workflow Opinionated Containers Layer 6 Source : https://www.mendix.com/blog/new-mendix-support-kubernetes-brings-choice-control/ OpenShift, Cloud Foundry, Docker Cloud, Deis, Apcera, Apprenda
  • 5.
    K8S 특징 5 • Automaticbinpacking • Self-healing • Horizontal scaling • Service discovery and Load balancing • Automatic rollouts and rollbacks • Secret and configuration management • Storage orchestration • Batch execution
  • 6.
    Kubernetes 구성 6 API UI CLI Kubernetes Cluster Control Plane (Master) Kubernetes Node1 Kubernetes Node 2 .. Kubernetes Node N Registry • API Server • Controller Manager Server • Scheduler Server • etcd • kubectl
  • 7.
    Cluster control plane 7 •Kubernetes Master • kube-apiserver • kube-scheduler • kube-controller-manager • cloud-controller-manager • etcd
  • 8.
    Master components Colocated, orspread across machines, as dictated by cluster size Kubernetes Cluster Control Plane 8 Kubernetes Master Node Schedulers REST (pods, services, rep. controllers) scheduling actuator Schedulers Controller managers (replication controller etc) kubectl (user commands) APIs Kubernetes Node Kubernetes Node Distributed Watchable Storages ( Implemented via etcd ) authentication authorization
  • 9.
    Kubernetes Node 9 • Worker •Container Runtime • kubelet • kube-proxy • cAdvisor
  • 10.
    Kubernetes Node 10 Kubernetes WorkerNode Kube Proxykubelet Ingress Controller Docker Kubernetes Master Pod container container container Pod container container container Pod container container cAdvisor ... Internet
  • 11.
    Kubernetes Object Model 11 •kube-apiserver를 통해 Kubernetes object 생성/관리
  • 12.
    Kubernetes Object APIversion 12 • Alpha  Beta  Stable • apps/v1alpha • apps/v1alpha2 • apps/v1beta • apps/v1beta2 • ... • apps/v1
  • 13.
    Kubernetes Objects 13 • Basicobjects • Pod • Service • Volume • Namespace • Controllers • ReplicaSet • ReplicationController • Deployment • StatefulSets • DaemonSet • Garbage Collection • Jobs • CronJob
  • 14.
    14 Datacenter 1 관리서버 개발서버운영서버 Datacenter 2 관리서버 개발서버 운영서버 Datacenter 3 관리서버 개발서버 운영서버 SPINE SPINE SPINE SPINE SPINE SPINE Fabric Fabric Cloud Leaf Cloud Leaf Mgmt Switch 관리서버 관리서버 Cloud Leaf Cloud Leaf Mgmt Switch 개발/테스트 서버 개발/테스트 서버 Cloud Leaf Cloud Leaf Mgmt Switch 운영서버 운영서버 운영서버 운영서버 운영서버 운영서버 Cloud Leaf Cloud Leaf Mgmt Switch 관리서버 관리서버 Cloud Leaf Cloud Leaf Mgmt Switch 개발테스트 서버 개발/테스트 서버 Cloud Leaf Cloud Leaf Mgmt Switch 운영서버 운영서버 운영서버 운영서버 운영서버 운영서버 Cloud Leaf Cloud Leaf Mgmt Switch 관리서버 관리서버 Cloud Leaf Cloud Leaf Mgmt Switch 개발/테스트 서버 개발/테스트 서버 Cloud Leaf Cloud Leaf Mgmt Switch 운영서버 운영서버 운영서버 운영서버 운영서버 운영서버
  • 15.
    Docker network 15 host container network hostnetwork docker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.2
  • 16.
    Docker network onmulti host 16 host container network host networkdocker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.2 host container network host networkdocker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.3 host container network host networkdocker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.4
  • 17.
    Docker network onmulti host 17 host container network host networkdocker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.2 host container network host networkdocker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.3 host container network host networkdocker0 veth eth0: 172.17.0.2 container eth0: 172.17.0.3 container eth0: 172.17.0.4 container eth0: 192.168.0.4 overlay network
  • 18.
    Kubernetes Architecture example 18 K8S클러스터 Master Node API Server Scheduler Controller Manager kubectl 사용자 어드민/운영 자/개발자 etcd Monitoring/Logging/Alert Prometheus Alert manager Logstash Elasticsearch Grafana Kibana Overlay network Worker Node Worker Node Worker Node Kube Proxy Kube Proxy Kube Proxy POD cAdvisor POD POD NodeJS POD Nginx cAdvisorPOD cAdvisor Web socket Kubelet Kubelet Kubelet Redis Prometheu s sidecar
  • 19.
    Scheduler 19 • Resource basedscheduling limit reservation usage Scheduler는 POD가 어떤 Node에 배치될지 결정 함 Node 2GB 2Core Kubelet + cAdvisor disktype = ssd Labels Resources Disks • nodeSelector or nodeAffinity based scheduling
  • 20.
    Controller-manager 20 • Node Controller: -노드의 상태 체크 • Replication Controller: - 모든 POD가 지정된 갯수 만큼 구동되게 유지 • Endpoints Controller: - Endpoint 객체 관리 ( Service 와 POD ) • Service Account & Token Controllers: - 새로운 네임스페이스에 대한 기본 계정 및 API 접속 토큰 발행
  • 21.
    Service discovery 21 • POD는Kubernetes Master의 Scheduler에 의해서 배치되고 관리됨 • POD는 고정된 접속 정보 없이 언제든지 클러스터내 서버 들에서 이동 가능함 • POD에 요청을 하기 위한 메커니즘이 필요 Node Pod 1 labels: app=MyApp port: 9376 Pod 2 labels: app=MyApp port: 9376 Pod 3 labels: app=MyApp port: 9376 kube-proxy Client ServiceIP (iptables) apiserver Node 1 Node 2 Node 3 S1 S2 S3 S4 Service Type • ClusterIP : 클러스터 내부에서만 사용 가능한 주소 (외부에서 호출 불가) • NodePort: 서비스 생성시 만들어진 포트로 접속가능 (클러스터의 NodeIP:NortPort) • LoadBalancer : 외부 loadbalancer에 의해 접속 가능한 주소  Kubernetes Service POD의 논리적 집합과 접속 할 수 있는 정책(Policy)이 정의되어 있는 객체
  • 22.
    Kubernetes 가치 22 • 전계층가용성 • 데이터센터, 서버, 네트워크 스토리지 장애에 영향 없는 무중단 서비스 구현 • 계층별 오류/고장에 대한 Fault Tolerant 방법 확인 • 워크로드 이식성 • 특정 데이터 센터, H/W에 종속되지 않는 어플리케이션 실행 • 동적 물리 서버 자원 증설하여 용량 확대 • 자동화 (수작업 최소화) • 서비스 중지 없이 변경사항 적용 자동화 • 어플리케이션 배포 중 무중단 서비스 제공 • 어플리케이션 독립성 • 외부 부하(CPU, 네트워크)에 영향 받지 않는 실행환경 독립성 검증 • 서비스 탄력성 • CPU 사용률, 응담시간등의 정책에 의한 동적 스케일링

Editor's Notes

  • #2 Blockchain essentially a database, but traditional databases have central admins, which makes using them to house transaction data involving parties that don’t trust one another problematic and expensive. So, each entity maintains their own database, resulting in duplicate data and, if there are mistakes or malicious behavior, results in expensive and time consuming disputes over what the actual state of the truth is. This is particularly true when exchanging assets. And lots of different institutions recording different assets.