readiness gate feature test


readiness gate test

prepare env

k create deployment echo --image xxxxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/felixecr:http-echolatest --replicas 4 

image source link: 
hashicorp/http-echo


  • this image will listen port 5678 by default *

modify tags part after creating




apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "2"
  labels:
    app: echohello
  name: echohello
  namespace: ingress-nginx
spec:
  progressDeadlineSeconds: 600
  replicas: 4
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: echohello
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: echohello
    spec:
      containers:
      - args:
        - -text=hello world
        # - "-listen=8080"
        image: 543054971342.dkr.ecr.cn-north-1.amazonaws.com.cn/felixecr:http-echolatest
        imagePullPolicy: IfNotPresent
        name: felixecr
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      terminationGracePeriodSeconds: 30

create service using below command and then modify the sevice annotations !!!important, do not forget the service type should be type: LoadBalancer

k expose deployment echo --port 5678

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
    service.beta.kubernetes.io/aws-load-balancer-type: external
  creationTimestamp: "2023-07-03T07:10:10Z"
  labels:
    app: echo
  name: echo
  namespace: default
  resourceVersion: "278638"
  uid: 141354e1-69f1-415b-81c4-e0f06a704b9c
spec:
  clusterIP: 172.20.184.156
  clusterIPs:
  - 172.20.184.156
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - port: 5678
    protocol: TCP
    targetPort: 5678
  selector:
    app: echo
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

if you want to expose the service as ip target then, check the below annotation
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type specifies the target type to configure for NLB. You can choose between instance and ip.

important
after testing in aws loadbalancer 2.7 if you edit the service type it won’t create any nlb for you, have to reapply the yaml file


文章作者: Felix Li
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Felix Li !
  目录