By default, ECI-based pods and the Service synchronization component start in parallel. In clusters with many Services and Service endpoints, synchronization can take long enough that a pod's outbound connections time out before the cluster IP addresses are ready. Add the k8s.aliyun.com/eci-wait-clusterip-ready annotation to delay pod creation until cluster IP synchronization is complete.
How it works
When the annotation is set, Elastic Container Instance (ECI) waits until all cluster IP addresses finish synchronizing across Services before creating the pod.
This is especially useful in big data workloads. In an Apache Spark job, for example, the executor pod must reach the Spark driver and CoreDNS immediately after startup. If the cluster IP address for those Services is not ready yet, the connection times out and the job fails.
Enabling this feature delays pod startup when the cluster contains many Services and Service endpoints.
Prerequisites
Before you begin, ensure that you have:
A Container Service for Kubernetes (ACK) cluster with ECI as the pod scheduling target
Add the annotation
Add the k8s.aliyun.com/eci-wait-clusterip-ready annotation to the pod metadata. Set the value to "*" to wait for all Services.
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: test
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
name: nginx-test
labels:
app: nginx
annotations:
k8s.aliyun.com/eci-wait-clusterip-ready: "*"
spec:
containers:
- name: nginx
image: registry.cn-shanghai.aliyuncs.com/eci_open/nginx:1.14.2
ports:
- containerPort: 80Keep the following constraints in mind:
Add the annotation to the
spec.template.metadatasection of a Deployment, not to the top-levelmetadata.The annotation only takes effect when the pod is first created. Adding or modifying it during an update has no effect.