IT/쿠버네티스 / / 2020. 1. 25.

[kubernetes] 쿠버네티스 설치 및 설정

포스팅 목차

    kubernetes cluster install tools

    google kubernetes engine (GKE)

    $ gcloud container clusters create xxxx
    $ gcloud container clusters list
    $ kubectl get nodes
    $ gcloud container clusters delete xxxx

    Minikube

    • open source project within Github kubernetes
    • download from google
    • assumes VirtualBox already installed
    • useful for developers
    • uses Go binary localkube
    • Also uses Docker
    $ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
    $ chmod +x minikube
    $ sudo mv minikube /usr/local/bin
    $ minikube start
    $ kubectl get nodes

     


    kubespray

    https://github.com/kubernetes-incubator/kubespray


    kubernetes operations (kops)

    • AWS 지원, GKE beta, VMWare alpha

    kubeadm

    • available since kubernetes 1.4.0
    • works with ubuntu 16.04 and cent os 7.1
    • main-step
      - Run kubeadm init on the head node
      - Create a network for IP-per-Pod criteria
      - Run kubeadm join on worker or secondary master nodes
    • documentation
      https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/
    • install A Pod Network
      1) Only one pod network per per cluster
      2) Several to choose from
      - Calico : projectcalico.org
      - Canal
      - Flannel : github.com/coreos/flannel
      - Kube-router : github.com/cloudnativelabs/kube-router
      - Romana : github.com/romana/romana
      - Weave Net : weave.works/oss/net
      $ kubectl create -f https://git.io./weave-kube
      3) Can become complicated to manage
      4) Several add-ons available

     


    kubectl 설치

    • install or compile kubectl
    • main binary for working with objects
    • available for common distributions via dedicated repos
    • configuration file : ~/.kube/config
      - endpoints
      - SSL keys
      - contexts

    설치시 고려 사항

    • Which provider should I use?
      Public or private cloud?
    • Which operating system should I use?
    • Which networking solution should I use?
      Do I need an overlay?
    • Where should I run my etcd cluster?
      3 node 형태로 많이 쓰임
    • Should I configure Highly-Available head nodes (master node)?
      고가용성 3가지
      - 서비스 자체 관점의 H/A
      - master 노드의 H/A (api-server, controller, scheduler..)
      - DB (ETCD) H/A

    주요 구성 설정들

    • single-node
    • Single head node(master node), multiple workers
    • Multiple head nodes with HA, multiple workers
    • HA etcd, HA head nodes, multiple workers
    • Federation(multi cloud) also provides higher availablility

     


    kubernetes를 위한 systemd unit file


    Hyperkube 사용한 설치

    • 각 이미지를 실행하여 master를 설치 할 수 있다.
    $ docker run --rm gcr.io/google_containers/hyperkube:v1.10.12 /hyperkube apiserver --help
    $ docker run --rm gcr.io/google_containers/hyperkube:v1.10.12 /hyperkube scheduler --help
    $ docker run --rm gcr.io/google_containers/hyperkube:v1.10.12 /hyperkube controller-manager --help

    source 로 부터 직접 컴파일

    • Configure Golang environment
    • Clone source code
    • May need to install other compiler and libraries

     

     

    참조) CKA 대비 간단 실습

    01. kubeadm 을 이용한 설치 및 세팅
    02. kubernetes 클러스터 노드 확장 및 셋팅
    03. 간단한 application 배포, yaml템플릿, 서비스 expose 해보기
    04. deployment 의 CPU, Memory 제약
    05. namespace 를 위한 resource limit 설정
    06. 좀더 복잡한 deployment 배포해보기
    07. 기본 Node 의 maintenance (유지보수)
    08. API AND ACCESS
    09. API 객체
    10. Managing State with Deployments
    11. Service Resource
    12. Volumes and Data : ConfigMap 간단 테스트
    13. PV 와 PVC 생성
    14. ResourceQuota 사용 (PVC Count 와 Usage를 제한)
    15. ingress 간단 실습
    16. Scheduling - label 사용한 pod 할당
    17. Scheduling - Taint를 이용한 pod 배포 관리
    18. 로깅과 트러블슈팅 : 로그위치와 로그 출력 보기
    19. 로깅과 트러블슈팅 : Metrics와 DashBoard
    20. CRD (Custom Resource Definition)
    21. helm
    22. Security - TLS
    23. Security - Authentication, Authorization, Admission
    24. HA(High Availability) 구성 - master node


    • 네이버 블로그 공유
    • 네이버 밴드 공유
    • 페이스북 공유
    • 카카오스토리 공유