Open bbb-86-ko opened 1 year ago
패스
/metrics/cadvisor
Deployment 구성을 활용하여 Canary 배포를 구성할 수 있다.
Example
name: frontend
replicas: 3
...
labels:
app: guestbook
tier: frontend
track: stable
...
image: gb-frontend:v3
name: frontend-canary
replicas: 1
...
labels:
app: guestbook
tier: frontend
track: canary
...
image: gb-frontend:v4
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#canary-deployment
https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments
Example
‘kind: Deployment
apiVersion: v1
metadata:
name: frontend
spec:
replicas: 3
template:
spec:
containers:
- name: frontend
image: brendanburns/frontend:v1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1 # Maximum amount of replicas to update at one time
maxUnavailable: 1 # Maximum amount of replicas unavailable during rollout’
https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment
Example
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app # Label
spec:
replicas: 2
... 생략 ...
---
apiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
selector:
app: my-app # Deployment labels.app
ports:
- protocol: TCP
port: 80
targetPort: 8080
Node Taint
Taints:gpu=true:nodSchedule
Pod 명세 1 : 스케쥴링됨
tolerations:
- key: "gpu"
operator: "Equal"
value: "true"
affect: "noSchedule"
Pod 명세 2 : 스케쥴링되지 않음
tolerations:
- key: "gpu"
operator: "Equal"
value: "true"
affect: "noSchedule"
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ResourceQuota
metadata:
name: pods-high
spec:
hard:
cpu: "1000"
memory: 200Gi
pods: "10"
scopeSelector:
matchExpressions:
- operator : In
scopeName: PriorityClass
values: ["high"]
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-min-max-demo-lr
spec:
limits:
- max:
cpu: "800m"
min:
cpu: "200m"
type: Container
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app.kubernetes.io/name: MyApp
ports:
# 기본적으로 그리고 편의상 `targetPort` 는 `port` 필드와 동일한 값으로 설정된다.
- port: 80
targetPort: 80
# 선택적 필드
# 기본적으로 그리고 편의상 쿠버네티스 컨트롤 플레인은 포트 범위에서 할당한다(기본값: 30000-32767)
nodePort: 30007
apiVersion: v1
kind: Service
metadata:
name: my-service
namespace: prod
spec:
type: ExternalName
externalName: my.database.example.com
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app.kubernetes.io/name: MyApp
ports:
- protocol: TCP
port: 80
targetPort: 9376
clusterIP: 10.0.171.239
type: LoadBalancer
status:
loadBalancer:
ingress:
- ip: 192.0.2.127
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
spec:
podSelector: {}
policyTypes:
- Ingress
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: internet-acccess
spec:
podSelector:
matchLabels:
allow-internet: "true"
policyTypes:
- Ingress
ingress:
- {}
Kubernetes Best Practices
1 주차
2 주차
3 주차
4 주차
5 주차
6 주차