클러스터란?
시작하기전
클러스터 정보
# kubectl cluster-info
클러스터 상태
# kubectl version # kuebtctl get componentstatuses NAME STATUS MESSAGE ERROR scheduler Healthy ok controller-manager Healthy ok etcd-0 Healthy {"health": "true"}
※ controller-manager : 클러스터의 동작을 제어, 다양한 컨트롤러를 실행하는 역할.
※ sheduler : 클러스터의 다른노드에 다른 pod 배치 및 로드밸런싱 역할.
※ etcd : 모든 API객체가 저장된 클러스터 저장소.
클러스터 이벤트 목록
# kubectl get events
클러스터 노드 목록
# kubectl get nodes
클러스터 노드 상세
# kubectl describe node {Node Name} Name: NodeName Roles: <none> Labels: beta.kubernetes.io/arch=amd64 beta.kubernetes.io/os=linux kubernetes.io/hostname=NodeName Annotations: node.alpha.kubernetes.io/ttl=0 volumes.kubernetes.io/controller-managed-attach-detach=true CreationTimestamp: Mon, 09 Jul 2018 13:32:05 +0900 Taints: <none> Unschedulable: false //운영정보 확인 Conditions: Type Status LastHeartbeatTime LastTransitionTime Reason Message ---- ------ ----------------- ------------------ ------ ------- OutOfDisk False Tue, 31 Jul 2018 11:12:06 +0900 Mon, 09 Jul 2018 13:32:05 +0900 KubeletHasSufficientDisk kubelet has sufficient disk space available MemoryPressure False Tue, 31 Jul 2018 11:12:06 +0900 Mon, 09 Jul 2018 13:32:05 +0900 KubeletHasSufficientMemory kubelet has sufficient memory available DiskPressure False Tue, 31 Jul 2018 11:12:06 +0900 Mon, 09 Jul 2018 13:32:05 +0900 KubeletHasNoDiskPressure kubelet has no disk pressure PIDPressure False Tue, 31 Jul 2018 11:12:06 +0900 Mon, 09 Jul 2018 13:32:05 +0900 KubeletHasSufficientPID kubelet has sufficient PID available Ready True Tue, 31 Jul 2018 11:12:06 +0900 Mon, 09 Jul 2018 13:32:15 +0900 KubeletReady kubelet is posting ready status Addresses: InternalIP: 100.00.00.00 Hostname: NodeName //용량정보 Capacity: cpu: 8 ephemeral-storage: 79140092Ki hugepages-2Mi: 0 memory: 8008968Ki pods: 110 Allocatable: cpu: 8 ephemeral-storage: 72935508667 hugepages-2Mi: 0 memory: 7906568Ki pods: 110 //리눅스커널 버전 정보 및 SW현황 System Info: Machine ID: 346dde... System UUID: 346DDE... Boot ID: 3945db... Kernel Version: 3.10.0... OS Image: CentOS Linux 7 (Core) Operating System: linux Architecture: amd64 Container Runtime Version: docker://17.3.2 Kubelet Version: v1.10.3 Kube-Proxy Version: v1.10.3 ExternalID: NodeName Non-terminated Pods: (4 in total) Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits --------- ---- ------------ ---------- --------------- ------------- default kuard 0 (0%) 0 (0%) 0 (0%) 0 (0%) default kuard-config 0 (0%) 0 (0%) 0 (0%) 0 (0%) kube-system kube-proxy-l2xlf 0 (0%) 0 (0%) 0 (0%) 0 (0%) kube-system weave-net-kfg4n 20m (0%) 0 (0%) 0 (0%) 0 (0%) Allocated resources: (Total limits may be over 100 percent, i.e., overcommitted.) CPU Requests CPU Limits Memory Requests Memory Limits ------------ ---------- --------------- ------------- 20m (0%) 0 (0%) 0 (0%) 0 (0%) Events: <none>
프록시
클러스터 내 서비스의 로드밸런싱을 위한 네트워크 트래픽을 라우팅.
클러스트의 모든 노드에 프록시가 존재해야 함.
쿠버네티스는 데몬세트 API객체를 가지고 있어 많은 클러스터에서 프록시 기능을 수행함.
다음과 같이 프록시 확인 가능
# kubectl get daemonSets --namespace=kube-system kube-proxy NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE kube-proxy 2 2 2 2 2 <none> 1h
DNS
클러스터에 정의된 서비스의 이름 지정과 검색을 제공.
DNS서버는 클러스터에서 복제된 서비스로 실행.
크기에 따라 클러스터에 하나 이상의 DNS 서버가 실행중임을 확인.
DNS 서비스는 복제본을 관리하는 deployment 로 실행.
# kubectl get deployments --namespace=kube-system kube-dns NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE kube-dns 1 1 1 1 1h
DNS에 대한 로드밸런싱 수행.
# kubectl get services --namespace=kube-system kube-dns NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP 2h
Dashboard
쿠버네티스 GUI.
디플로이먼트로 관리
# kubectl get deployments --namespace=kube-system kubernetes-dashboard NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE kubernetes-dashboard 1 1 1 1 13d
Dashboard Service 수행.
# kubectl get services --namespace=kube-system kubernetes-dashboard NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes-dashboard ClusterIP 10.104.99.3 <none> 443/TCP 13d