우주먼지
Published 2023. 2. 20. 12:55
Kubernetes Namespace Ops/Kubernetes

💡 Namespace

 

  • 물리 클러스터 기반의 가상 클러스터, 기본 네임스페이스는 default 이다.
  • 같은 네임스페이스 내에서 리소스의 이름은 중복 불가능

 


Kubectl 기반 Namespace 생성

# 1. yaml의 metadata 하위 name: 에 지정해도 됨
# 2. 리소스를 생성할때 -n [namespace-name] 으로 옵션 지정도 가능
# 3. kube-node-lease, kube-system, kube-public 네임스페이스는 사용하지 않는게 좋음

# Namespace 생성
kubectl create namespace [namespace-name]

# Namespace 조회
kubectl get ns

# 기본 Namespace의 모든 Resource 조회
kubectl get all -o wide -n default

# 현재 사용중인 기본 네임스페이스 변경
kubectl config set-context --current --namespace=[namespace-name]
# 변경된 네임스페이스 확인
kubectl config view | grep namespace

img

 


Yaml 기반 Namespace 생성

apiVersion: v1
kind: Namespace
metadata:
  name: test  
spec:
  limits:
  - default:
      cpu: 1
    defaultRequest:
      cpu: 0.5
    type: Container

'Ops > Kubernetes' 카테고리의 다른 글

Kubernetes Deployment  (0) 2023.02.25
Kubernetes Labels  (0) 2023.02.24
Kubernetes Pod  (0) 2023.02.20
Kubernetes의 구성요소  (0) 2023.02.19
Kubernetes 테스트 환경 구성 (Kubespray & Ansible 구축)  (0) 2023.02.11
profile

우주먼지

@o귤o

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

검색 태그