Spot에서 워크로드 실행
다음으로, 샘플 소매점 애플리케이션을 수정하여 새로 생성된 Spot 인스턴스에서 catalog 컴포넌트를 실행해 보겠습니다. 이를 위해 Kustomize를 사용하여 catalog Deployment에 패치를 적용하고, eks.amazonaws.com/capacityType: SPOT이 포함된 nodeSelector 필드를 추가합니다.
- Kustomize Patch
- Deployment/catalog
- Diff
~/environment/eks-workshop/modules/fundamentals/mng/spot/deployment/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: catalog
spec:
template:
spec:
nodeSelector:
eks.amazonaws.com/capacityType: SPOT
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/created-by: eks-workshop
app.kubernetes.io/type: app
name: catalog
namespace: catalog
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: service
app.kubernetes.io/instance: catalog
app.kubernetes.io/name: catalog
template:
metadata:
annotations:
prometheus.io/path: /metrics
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
labels:
app.kubernetes.io/component: service
app.kubernetes.io/created-by: eks-workshop
app.kubernetes.io/instance: catalog
app.kubernetes.io/name: catalog
spec:
containers:
- envFrom:
- configMapRef:
name: catalog
- secretRef:
name: catalog-db
image: public.ecr.aws/aws-containers/retail-store-sample-catalog:1.2.1
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 3
name: catalog
ports:
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
periodSeconds: 5
successThreshold: 3
resources:
limits:
memory: 512Mi
requests:
cpu: 250m
memory: 512Mi
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
volumeMounts:
- mountPath: /tmp
name: tmp-volume
nodeSelector:
eks.amazonaws.com/capacityType: SPOT
securityContext:
fsGroup: 1000
serviceAccountName: catalog
volumes:
- emptyDir:
medium: Memory
name: tmp-volume