Search

Deployment

IMAGE_URL=$(aws ecr describe-repositories --repository-name service --query "repositories[?repositoryName=='service'].repositoryUri" --output text --region ap-northeast-2) IMAGE_A_TAG=$(aws ecr describe-images --repository-name service --query "imageDetails[?contains(imageTags, 'a')].imageTags" --output text --region ap-northeast-2) IMAGE_A="$IMAGE_URL:$IMAGE_A_TAG"
Shell
복사
sed -i "s|IMAGE-A|$IMAGE_A|g" service-a.yaml
Shell
복사
kubectl apply -f service-a.yaml
Shell
복사
apiVersion: apps/v1 kind: Deployment metadata: name: service-b namespace: app labels: app: service-b spec: replicas: 2 selector: matchLabels: app: service-b template: metadata: labels: app: service-b spec: containers: - name: service-b-conatiner image: IMAGE-B imagePullPolicy: Always ports: - containerPort: 8080 name: http volumeMounts: - name: log-volume mountPath: /log - name: fluent-bit-cnt image: fluent/fluent-bit:latest imagePullPolicy: IfNotPresent ports: - containerPort: 2020 name: metrics protocol: TCP volumeMounts: - name: config-volume mountPath: /fluent-bit/etc/ - name: log-volume mountPath: /log volumes: - name: log-volume emptyDir: {} - name: config-volume configMap: name: fluent-bit-sidecar-b-config
YAML
복사
IMAGE_URL=$(aws ecr describe-repositories --repository-name service --query "repositories[?repositoryName=='service'].repositoryUri" --output text --region ap-northeast-2) IMAGE_B_TAG=$(aws ecr describe-images --repository-name service --query "imageDetails[?contains(imageTags, 'b')].imageTags" --output text --region ap-northeast-2) IMAGE_B="$IMAGE_URL:$IMAGE_B_TAG"
Shell
복사
sed -i "s|IMAGE-B|$IMAGE_B|g" service-b.yaml
Shell
복사
kubectl apply -f service-b.yaml
Shell
복사
apiVersion: apps/v1 kind: Deployment metadata: name: service-c namespace: app labels: app: service-c spec: replicas: 2 selector: matchLabels: app: service-c template: metadata: labels: app: service-c spec: containers: - name: service-c-conatiner image: IMAGE-C imagePullPolicy: Always ports: - containerPort: 8080 name: http volumeMounts: - name: log-volume mountPath: /log - name: fluent-bit-cnt image: fluent/fluent-bit:latest imagePullPolicy: IfNotPresent ports: - containerPort: 2020 name: metrics protocol: TCP volumeMounts: - name: config-volume mountPath: /fluent-bit/etc/ - name: log-volume mountPath: /log volumes: - name: log-volume emptyDir: {} - name: config-volume configMap: name: fluent-bit-sidecar-c-config
YAML
복사
IMAGE_URL=$(aws ecr describe-repositories --repository-name service --query "repositories[?repositoryName=='service'].repositoryUri" --output text --region ap-northeast-2) IMAGE_C_TAG=$(aws ecr describe-images --repository-name service --query "imageDetails[?contains(imageTags, 'c')].imageTags" --output text --region ap-northeast-2) IMAGE_C="$IMAGE_URL:$IMAGE_C_TAG"
Shell
복사
sed -i "s|IMAGE-C|$IMAGE_C|g" service-c.yaml
Shell
복사
kubectl apply -f service-c.yaml
Shell
복사