Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- aews vault
- HPA
- eks endpoint access
- CAS
- volume
- 클라우드 엔지니어
- VPA
- storageclass
- 합격 후기
- Python
- 공부 방법
- kubernetes
- 외부 모듈
- EKS
- aews
- 도커
- keda
- Jenkins
- AWS
- 클라우드 국비지원교육
- observability
- karpenter
- aews ci/cd
- POD
- 국비지원교육
- docker
- 단기 합격
- Terraform
- k8s
- 클라우드 국비지원교육 후기
Archives
- Today
- Total
모험가
Namespace, ResourceQuota, LimitRange (기초) 본문
이 글은 인프런의 대세는 쿠버네티스 강의를 보며 정리한 글입니다.
Namespace
- 한 네임스페이스안에 같은 object의 이름은 중복이 불가
- 같은 파드를 중복이 불가
- 타 네임스페이스와 리소스가 분리
- namespace를 지우면 안의 리소스도 다 지워짐
ResourceQuota
- 네임스페이스의 자원 한계를 정의함
- 파드는 자원을 나타내야 함
- 네임스페이스의 자워 한계를 넘기는 파드는 못 만듬
LimitRange
- 각 파드의 자원 한계를 정의함
- min~max로 정의
- request와 limit의 비율 한계도 정해줄 수 있다. (maxLimitRequestRatio)
실습
1. Namespace

1-1) Namespace
apiVersion: v1
kind: Namespace
metadata:
name: nm-1
1-2) Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-1
namespace: nm-1
labels:
app: pod
spec:
containers:
- name: container
image: kubetm/app
ports:
- containerPort: 8080
1-3) Service
apiVersion: v1
kind: Service
metadata:
name: svc-1
namespace: nm-1
spec:
selector:
app: pod
ports:
- port: 9000
targetPort: 8080
1-1') Namespace
apiVersion: v1
kind: Namespace
metadata:
name: nm-2
1-2') Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-1
namespace: nm-2
labels:
app: pod
spec:
containers:
- name: container
image: kubetm/init
ports:
- containerPort: 8080
pod ip :
curl 10.16.36.115:8080/hostname
service ip :
curl 10.96.92.97:9000/hostname
Namespace Exception
e-1) Service
apiVersion: v1
kind: Service
metadata:
name: svc-2
spec:
ports:
- port: 9000
targetPort: 8080
nodePort: 30000
type: NodePort
e-2) Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-2
spec:
nodeSelector:
kubernetes.io/hostname: k8s-node1
containers:
- name: container
image: kubetm/init
volumeMounts:
- name: host-path
mountPath: /mount1
volumes:
- name : host-path
hostPath:
path: /node-v
type: DirectoryOrCreate
echo "hello" >> hello.txt
2. ResourceQuota

2-1) Namespace
apiVersion: v1
kind: Namespace
metadata:
name: nm-3
2-2) ResourceQuota
apiVersion: v1
kind: ResourceQuota
metadata:
name: rq-1
namespace: nm-3
spec:
hard:
requests.memory: 1Gi
limits.memory: 1Gi
ResourceQuota Check Command
kubectl describe resourcequotas --namespace=nm-3
2-3) Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-2
spec:
containers:
- name: container
image: kubetm/app
2-4) Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-3
spec:
containers:
- name: container
image: kubetm/app
resources:
requests:
memory: 0.5Gi
limits:
memory: 0.5Gi
3. LimitRange

3-1) Namespace
apiVersion: v1
kind: Namespace
metadata:
name: nm-5
3-2) LimitRange
apiVersion: v1
kind: LimitRange
metadata:
name: lr-1
spec:
limits:
- type: Container
min:
memory: 0.1Gi
max:
memory: 0.4Gi
maxLimitRequestRatio:
memory: 3
defaultRequest:
memory: 0.1Gi
default:
memory: 0.2Gi
LimitRange Check Command
kubectl describe limitranges --namespace=nm-5
3-3) Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-1
spec:
containers:
- name: container
image: kubetm/app
resources:
requests:
memory: 0.1Gi
limits:
memory: 0.5Gi
LimitRange Exception
e-1) Namespace
apiVersion: v1
kind: Namespace
metadata:
name: nm-6
e-2) LimitRange
apiVersion: v1
kind: LimitRange
metadata:
name: lr-5
spec:
limits:
- type: Container
min:
memory: 0.1Gi
max:
memory: 0.5Gi
maxLimitRequestRatio:
memory: 1
defaultRequest:
memory: 0.5Gi
default:
memory: 0.5Gi
e-3) LimitRange
apiVersion: v1
kind: LimitRange
metadata:
name: lr-3
spec:
limits:
- type: Container
min:
memory: 0.1Gi
max:
memory: 0.3Gi
maxLimitRequestRatio:
memory: 1
defaultRequest:
memory: 0.3Gi
default:
memory: 0.3Gi
e-4) Pod
apiVersion: v1
kind: Pod
metadata:
name: pod-1
spec:
containers:
- name: container
image: kubetm/app
현재 실습 환경이 준비가 안되어 나중에 해보기
'쿠버네티스 > 기초' 카테고리의 다른 글
Deployment - Recreate, RollingUpdate (기초) (0) | 2022.08.05 |
---|---|
컨트롤러 (기초) ReplicaSet, Controller (0) | 2022.08.05 |
ConfigMap, Secret (기초) (0) | 2022.08.05 |
Volume (기초) (0) | 2022.07.28 |
Service (기초) (0) | 2022.07.28 |