Skip to content

Scaling a service to 0 replicas deletes EndpointSlice annotations and finalizers #108267

@ghost

Description

What happened?

I added a finalizer and a couple of annotations to an EndpointSlice. When I scaled the parent service down to 0 replicas the EndpointSlice's annotations and finalizers were deleted.

What did you expect to happen?

The EndpointSlice's annotations and finalizers don't change.

How can we reproduce it (as minimally and precisely as possible)?

Create a deployment and service:

kubectl create deployment echoserver --image=k8s.gcr.io/echoserver:1.10
kubectl create service nodeport echoserver --tcp=8080:8080

Add an annotation to the endpointslice that belongs to the service:

kubectl annotate endpointslices echoserver-d5gtd foo=bar # "d5gtd" will be different in your case

Verify that the annotation can be read:

kubectl get endpointslices echoserver-d5gtd -o=jsonpath='{.metadata.annotations}'
{"foo":"bar"}

Scale the deployment down to zero replicas:

kubectl scale deployment echoserver --replicas=0

It takes a few seconds for the pod to terminate, but once it does the annotation is destroyed:

kubectl get endpointslices echoserver-d5gtd -o=jsonpath='{.metadata.annotations}' # produces no output

Anything else we need to know?

No response

Kubernetes version

Details
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:38:05Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.6-3+7ab10db7034594", GitCommit:"7ab10db7034594f057421b40f64481638350b80b", GitTreeState:"clean", BuildDate:"2022-01-26T21:56:08Z", GoVersion:"go1.16.13", Compiler:"gc", Platform:"linux/amd64"}

Cloud provider

Details None, I'm running microk8s in a Vagrant VM on my development workstation.

OS version

Details
# On Linux:
$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
$ uname -a
Linux refectory 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux

Install tools

Details Microk8s

Container runtime (CRI) and and version (if applicable)

Details n/a

Related plugins (CNI, CSI, ...) and versions (if applicable)

Details n/a

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/networkCategorizes an issue or PR as relevant to SIG Network.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions