본문 바로가기

클라우드/쿠버네티스(Kubernetes)

쿠버네티스 Kubernetes API 1

API-RESOURCE NAME API-VERSION KIND
bindings v1 Binding
configmaps (cm) v1 ConfigMap
endpoints (ep) v1 Endpoints
limitranges (limits) v1 LimitRange
namespaces (ns) v1 Namespace
nodes (no) v1 Node
persistentvolumeclaims (pvc) v1 PersistentVolumeClaim
persistentvolumes (pv) v1 PersistentVolume
pods (po) v1 Pod
replicationcontrollers (rc) v1 ReplicationController
resourcequotas (quota) v1 ResourceQuota
secrets v1 Secret
serviceaccounts (sa) v1 ServiceAccount
services (svc) v1 Service
daemonsets (ds) apps/v1 DaemonSet
deployments (deploy) apps/v1 Deployment
replicasets (rs) apps/v1 ReplicaSet
statefulsets (sts) apps/v1 StatefulSet
horizontalpodautoscalers (hpa) autoscaling /v1 HorizontalPodAutoscaler
cronjobs (cj) batch/v1, v1beta1 CronJob
jobs batch/v1, v1beta1 Job
ingresses (ing) extensions/v1beta1 Ingress
ingresses (ing) networking.k8s.io/v1, v1beta1 Ingress
clusterrolebindings rbac.authorization.k8s.io/v1, v1beta1 ClusterRoleBinding
clusterroles rbac.authorization.k8s.io/v1, v1beta1 ClusterRole
rolebindings rbac.authorization.k8s.io/v1, v1beta1 RoleBinding
roles rbac.authorization.k8s.io/v1, v1beta1 Role
storageclasses (sc)  storage.k8s.io/v1, v1beta1 StorageClass

더보기

# object 
YAML파일을 이용하여 쿠버네티스의 리소스를 만드는 오브젝트를 작성 
-> 오브텍트를 실행해서 리소스를 만든다
manifest라고도한다

vagrant@k-control:~$ cat ldh-pod.yaml
apiVersion: v1                       # api라는 오브젝트를 생성하기 위한 버전
kind: Pod                            # 리소스의 종류 : 종류에따라 api 버전이 달라진다
metadata:                            # 리소스의 이름을 붙일때 사용 (metadata : 데이터를 관리하기위한 데이터)
  name: ldh-pod
spec:                                # 리소스 종류에 따라 스펙이 달라진다 
  containers:
  - image: nginx 
    name: ldh
    ports:
    - containerPort: 8080
      protocol: TCP

 

 

 

더보기

# kubectl 
# kubectl 작업은 컨트롤러에서만 할 수 있다
# config 자격증명 파일이 있어서 작업가 능 
vagrant@k-control:~$ ls -l ~/.kube
-rw------- 1 vagrant vagrant 5454 Jul  6 07:47 config


# 쿠버네티스에서 정의 할 수 있는 리소스의 종류 
vagrant@k-control:~$ kubectl api-resources
NAME                              SHORTNAMES   APIGROUP          NAMESPACED           KIND
bindings                                                         true                 Binding
componentstatuses                 cs                             false                ComponentStatus
configmaps                        cm                             true                 ConfigMap
endpoints                         ep                             true                 Endpoints
events                            ev                             true                 Event
...(생략)...
                           #약자    (빈칸) 핵심그룹 core group  네임스페이스 사용 유무  KIND뒤에 VALUE값에 넣는 리소스 종류


# pod라는 리소스의 목록 확인 
agrant@k-control:~$ kubectl get pods -A
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
default       ldh-pod                                    1/1     Running   0          65m
kube-system   calico-kube-controllers-5978c5f6b5-zhhhd   1/1     Running   2          24h
kube-system   calico-node-282ch                          1/1     Running   1          24h
...(생략)...


# API서버의 버전에서 지원하는 API 목록
# 버전이 바뀌면 목록도 달라진다
vagrant@k-control:~$ kubectl api-versions
admissionregistration.k8s.io/v1
admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1
apiextensions.k8s.io/v1beta1
...(생략)...   
             #API그룹 /API버전 
             
             
# 버전의 의미
# alpha 버전의 api 
기본적으로 비활성화 되어있다
버그가 있을 수 있다 (개발중)
쿠버네티스 자체를 개발하는 개발자가 사용
사용자는 사용안함
기능에대한 기술지원이 중단될수있다


# beta 버전
완전하게 완성된건 아니다
코드가 잘 테스트되었고 활성화시켜도 안전
활성화 되어있다
기능이 바뀔수있다(바뀌면 가이드 제공) 기술지원이 중단되진않는다
기능이 바뀌어서 재정의를 할때 리소스가 다시 만들어져야한다
다운타임 발생 , 새로 컨테이너 만들어야 함
중요하지 않는 용도로 사용


# stable
안정화버전


#api버전 개발단계
 alpha-> beta-> stable