반응형
Kubernetes 리소스 조회
# 리소스 조회
kubectl get namespace
kubectl get node
kubectl get pod
master@master:~$ kubectl get namespace
kubectl get node
kubectl get podNAME STATUS AGE
kube-system Active 73m
default Active 73m
kube-public Active 73m
kube-node-lease Active 73m
master@master:~$ kubectl get node
NAME STATUS ROLES AGE VERSION
master Ready master 73m v1.17.4+k3s1
master@master:~$ kubectl get pod
NAME READY STATUS RESTARTS AGE
jinsunginx 1/1 Running 0 16m
master@master:~$
Kubernetes 모든 리소스 조회
# 클러스터에 모든 리소스 조회
master@master:~$ 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
limitranges limits true LimitRange
namespaces ns false Namespace
nodes no false Node
persistentvolumeclaims pvc true PersistentVolumeClaim
persistentvolumes pv false PersistentVolume
pods po true Pod
podtemplates true PodTemplate
replicationcontrollers rc true ReplicationController
resourcequotas quota true ResourceQuota
secrets true Secret
serviceaccounts sa true ServiceAccount
services svc true Service
mutatingwebhookconfigurations admissionregistration.k8s.io false MutatingWebhookConfiguration
validatingwebhookconfigurations admissionregistration.k8s.io false ValidatingWebhookConfiguration
customresourcedefinitions crd,crds apiextensions.k8s.io false CustomResourceDefinition
apiservices apiregistration.k8s.io false APIService
controllerrevisions apps true ControllerRevision
daemonsets ds apps true DaemonSet
deployments deploy apps true Deployment
replicasets rs apps true ReplicaSet
statefulsets sts apps true StatefulSet
tokenreviews authentication.k8s.io false TokenReview
localsubjectaccessreviews authorization.k8s.io true LocalSubjectAccessReview
selfsubjectaccessreviews authorization.k8s.io false SelfSubjectAccessReview
selfsubjectrulesreviews authorization.k8s.io false SelfSubjectRulesReview
subjectaccessreviews authorization.k8s.io false SubjectAccessReview
horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler
cronjobs cj batch true CronJob
jobs batch true Job
certificatesigningrequests csr certificates.k8s.io false CertificateSigningRequest
leases coordination.k8s.io true Lease
endpointslices discovery.k8s.io true EndpointSlice
events ev events.k8s.io true Event
ingresses ing extensions true Ingress
helmcharts helm.cattle.io true HelmChart
addons k3s.cattle.io true Addon
ingresses ing networking.k8s.io true Ingress
networkpolicies netpol networking.k8s.io true NetworkPolicy
runtimeclasses node.k8s.io false RuntimeClass
poddisruptionbudgets pdb policy true PodDisruptionBudget
podsecuritypolicies psp policy false PodSecurityPolicy
clusterrolebindings rbac.authorization.k8s.io false ClusterRoleBinding
clusterroles rbac.authorization.k8s.io false ClusterRole
rolebindings rbac.authorization.k8s.io true RoleBinding
roles rbac.authorization.k8s.io true Role
priorityclasses pc scheduling.k8s.io false PriorityClass
csidrivers storage.k8s.io false CSIDriver
csinodes storage.k8s.io false CSINode
storageclasses sc storage.k8s.io false StorageClass
volumeattachments storage.k8s.io false VolumeAttachment
master@master:~$
자동완성 명령어
# 자동완성 기능
master@master:~$ echo "source <(kubectl completion bash)" >> ~/.bashrc
master@master:~$ source ~/.bashrc
사용자 인증 파일 확인
# kubectl 명령을 이용하여 확인
master@master:~$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://127.0.0.1:6443
name: default
contexts:
- context:
cluster: default
user: default
name: default
current-context: default
kind: Config
preferences: {}
users:
- name: default
user:
password: 4275a8b14f67fb2159b6a7f88facc091
username: admin
master@master:~$
# master node가 가지고 있는 config파일로 확인
master@master:~$ cat ~/.kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJWekNCL3FBREFnRUNBZ0VBTUFvR0NDcUdTTTQ5QkFNQ01DTXhJVEFmQmdOVkJBTU1HR3N6Y3kxelpYSjIKWlhJdFkyRkFNVFkxT1RnME5qa3hNakFlRncweU1qQTRNRGN3TkRNMU1USmFGdzB6TWpBNE1EUXdORE0xTVRKYQpNQ014SVRBZkJnTlZCQU1NR0dzemN5MXpaWEoyWlhJdFkyRkFNVFkxT1RnME5qa3hNakJaTUJNR0J5cUdTTTQ5CkFnRUdDQ3FHU000OUF3RUhBMElBQkR6S2t1bU1TbGVwd0VaSG9NeldidS9lSzRhT2RUQ1hWcHlEWVBmWXdCcjUKY0t0a2ZMVHZvVHZ6SG9pOXdrOU9TNC9CRHc3bHJxbHZoeHJZZ0dLYm02NmpJekFoTUE0R0ExVWREd0VCL3dRRQpBd0lDcERBUEJnTlZIUk1CQWY4RUJUQURBUUgvTUFvR0NDcUdTTTQ5QkFNQ0EwZ0FNRVVDSUdnVFFwZ3NROUJnCkJ5RVpJQlgrbzlsZVBsL0QwRi9VUGQ0azB0Zk4xVzQrQWlFQW9WdVBoUWtPNXd4bjJkU1Jtck5lYW9BbWlLeGsKL0hGRWlBQlNoRUhSblZZPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://127.0.0.1:6443
name: default
contexts:
- context:
cluster: default
user: default
name: default
current-context: default
kind: Config
preferences: {}
users:
- name: default
user:
password: 4275a8b14f67fb2159b6a7f88facc091
username: admin
master@master:~$
클러스터 상태 확인
# Cluster 상태 확인
master@master:~$ kubectl cluster-info
Kubernetes master is running at https://127.0.0.1:6443
CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
master@master:~$
참고자료
https://kubernetes.io/ko/docs/reference/kubectl/cheatsheet/
반응형
'Kubernetes' 카테고리의 다른 글
[K8S] 쿠버네티스 - YAML 파일로 Pod 생성 (0) | 2022.08.07 |
---|---|
[K8S] 쿠버네티스 - k3s 구성 (0) | 2022.08.07 |
[K8S] 쿠버네티스 - Pod 구성 (0) | 2022.08.07 |
[K8S] 쿠버네티스 설치 (0) | 2022.08.07 |
[K8S] Kubernetes 란 무엇인가? (0) | 2022.08.07 |