Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API complains on resources exist during helm install and which actually not #8708

Closed
tibetsam opened this issue Oct 20, 2023 · 21 comments
Closed
Assignees
Milestone

Comments

@tibetsam
Copy link

tibetsam commented Oct 20, 2023

Environmental Info:
K3s Version:
k3s version v1.27.5+k3s1 (8d074ec)
go version go1.20.7

Node(s) CPU architecture, OS, and Version:
uname -a
Linux 8BMQ363 5.3.18-150300.59.118-default #1 SMP Tue Apr 4 15:18:05 UTC 2023 (d9b953c) x86_64 x86_64 x86_64 GNU/Linux

Cluster Configuration:
single node with postgresql as etcd db
Postgresql Config:
~/yang-provider # cat /var/lib/pgsql/data/postgresql.conf
listen_addresses = '10.10.202.1' # what IP address(es) to listen on;
max_connections = 200

k3s-server config:
~/yang-provider # cat /etc/rancher/k3s/k3s-server.env
K3S_SERVER_ARGS="--disable coredns,servicelb,traefik,local-storage,metrics-server
--flannel-backend=none
--datastore-endpoint='postgres://k3s:k3s@10.10.202.1:5432/k3s?sslmode=disable'
--pause-image=docker-registry.docker-registry.svc.cluster.local:5000/rancher/mirrored-pause:3.6
--bind-address 10.10.202.1
--node-ip=10.10.202.1
--service-cidr 10.10.201.0/24
--cluster-dns 10.10.201.10
--cluster-cidr=10.10.200.0/24
--disable-network-policy
--kube-controller-manager-arg node-cidr-mask-size=24
--kubelet-arg config=/var/lib/rancher/k3s/server/kubelet.yaml
--kube-apiserver-arg feature-gates=ServiceIPStaticSubrange=true
--kube-apiserver-arg='audit-log-path=/var/log/k3s/audit/audit.log'
--kube-apiserver-arg='audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
--debug
-v=9
--log=/var/log/k3s/k3s.log
--kube-apiserver-arg event-ttl=4h"

Describe the bug:
during helm installation kube-api complains resources exist, but while checking cluster information, the resources were not there.

Steps To Reproduce:
run this simply one line script with given chart in https://github.com/tibetsam/yang-provider
~/yang-provider # for i in $(seq 1 20); do printf "\nINSTALLING, $i ITERATION\n"; helm install yang -n pc ./ ; kubectl get configmap yang-provider-confd-config -n pc; echo "sleeping 5s"; sleep 5; echo "DELETING"; helm delete yang -n pc; done

INSTALLING, 1 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 13:59:52 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 2 ITERATION
Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 3 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:00:07 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 4 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:00:15 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 5 ITERATION
Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 6 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:00:30 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 7 ITERATION
Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 8 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:00:44 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 9 ITERATION
Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 10 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:00:59 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 11 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:01:08 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 12 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:01:17 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 13 ITERATION
Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 14 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:01:34 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 15 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:01:42 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 16 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:01:49 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 17 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:01:57 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 18 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:02:04 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 19 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:02:11 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 20 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 14:02:19 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

Expected behavior:
helm install should succeed no matter how many times install/uninstall

Actual behavior:
helm install failing time to time

Additional context / logs:

@tibetsam
Copy link
Author

additional logs from postgres and audit.log shows that although db receives insert command, but looks like data isn't saved correctly in DB, bcz looking at the pattern in postgres log and timestamp in audit.log, we can see that whenever api fails, the following db insert command uses same prev_revision.
postgres.log
2023-10-20 15:01:33.852 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:34.021 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:34.022 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '0', $6 = '0', $7 = '
2023-10-20 15:01:34.408 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:40.212 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:40.215 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:40.217 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '0', $3 = '1', $4 = '1318860', $5 = '1318860', $6 = '0', $7 = '
2023-10-20 15:01:41.290 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:41.468 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:41.471 UTC k3s k3s [13963]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1318883', $6 = '0', $7 = '
2023-10-20 15:01:41.839 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:47.654 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:47.658 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:47.660 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '0', $3 = '1', $4 = '1318898', $5 = '1318898', $6 = '0', $7 = '
2023-10-20 15:01:48.712 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:48.903 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:48.906 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1318924', $6 = '0', $7 = '
2023-10-20 15:01:49.278 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:55.116 UTC k3s k3s [16184]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:55.121 UTC k3s k3s [16184]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:55.124 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '0', $3 = '1', $4 = '1318939', $5 = '1318939', $6 = '0', $7 = '
2023-10-20 15:01:56.201 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:01:56.389 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:01:56.391 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1318963', $6 = '0', $7 = '
2023-10-20 15:01:56.746 UTC k3s k3s [13965]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:02.545 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:02.554 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:02.556 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '0', $3 = '1', $4 = '1318979', $5 = '1318979', $6 = '0', $7 = '
2023-10-20 15:02:03.629 UTC k3s k3s [16586]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:03.808 UTC k3s k3s [16586]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:03.811 UTC k3s k3s [16586]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319002', $6 = '0', $7 = '
2023-10-20 15:02:04.175 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:10.017 UTC k3s k3s [16923]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:10.034 UTC k3s k3s [16924]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:10.037 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '0', $3 = '1', $4 = '1319018', $5 = '1319018', $6 = '0', $7 = '
2023-10-20 15:02:11.103 UTC k3s k3s [16586]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:11.311 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:11.314 UTC k3s k3s [15886]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319044', $6 = '0', $7 = '
2023-10-20 15:02:11.329 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:11.699 UTC k3s k3s [16978]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:17.520 UTC k3s k3s [17216]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:18.580 UTC k3s k3s [16978]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:18.760 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:18.763 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319044', $6 = '0', $7 = '
2023-10-20 15:02:19.128 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:24.950 UTC k3s k3s [17541]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:24.955 UTC k3s k3s [17541]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:24.958 UTC k3s k3s [16978]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '0', $3 = '1', $4 = '1319098', $5 = '1319098', $6 = '0', $7 = '
2023-10-20 15:02:26.037 UTC k3s k3s [17542]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:26.229 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:26.232 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319122', $6 = '0', $7 = '
2023-10-20 15:02:26.246 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:26.599 UTC k3s k3s [17542]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:32.442 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:33.499 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:33.695 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:33.697 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319122', $6 = '0', $7 = '
2023-10-20 15:02:33.994 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'

audit log:
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"b1df0f5a-9f0b-46b5-a1a1-65970f5429e0","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:01:34.012171Z","stageTimestamp":"2023-10-20T15:01:34.033374Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"130cc136-2b88-448b-a96f-9c3af56a1a1e","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:01:41.460761Z","stageTimestamp":"2023-10-20T15:01:41.489885Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"5745943d-1334-4cfc-8793-761335452211","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:01:48.889951Z","stageTimestamp":"2023-10-20T15:01:48.920542Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"d6bf8b08-c5dd-4ea3-b3a9-15c7acb192c7","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:01:56.376602Z","stageTimestamp":"2023-10-20T15:01:56.407530Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"390a3ae1-3d50-45bc-88d1-4c3ee808e756","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:02:03.795302Z","stageTimestamp":"2023-10-20T15:02:03.827643Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"b4e3b4ba-2223-4b0b-a94f-25b1eaa1b4c8","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"status":"Failure","message":"configmaps "yang-provider-confd-config" already exists","reason":"AlreadyExists","details":{"name":"yang-provider-confd-config","kind":"configmaps"},"code":409},"requestReceivedTimestamp":"2023-10-20T15:02:11.300403Z","stageTimestamp":"2023-10-20T15:02:11.330231Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"62311d36-b48d-46a5-a79b-e1bd03e7103f","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:02:18.746873Z","stageTimestamp":"2023-10-20T15:02:18.778152Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"9ce9f005-3e39-4e91-a254-aaff9296ed66","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"status":"Failure","message":"configmaps "yang-provider-confd-config" already exists","reason":"AlreadyExists","details":{"name":"yang-provider-confd-config","kind":"configmaps"},"code":409},"requestReceivedTimestamp":"2023-10-20T15:02:26.216425Z","stageTimestamp":"2023-10-20T15:02:26.247106Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}
{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"2f3d09c8-7abc-4146-8ab2-5595b85c56d4","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:02:33.681942Z","stageTimestamp":"2023-10-20T15:02:33.712285Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}

@brandond
Copy link
Member

brandond commented Oct 20, 2023

~/yang-provider # for i in $(seq 1 20); do printf "\nINSTALLING, $i ITERATION\n"; helm install yang -n pc ./ ; kubectl get configmap yang-provider-confd-config -n pc; echo "sleeping 5s"; sleep 5; echo "DELETING"; helm delete yang -n pc; done

Don't do that.

Kubernetes has an eventual consistency model. When you delete a resource, it isn't actually deleted immediately. It just sets a deletion timestamp on the object, and any controllers that have a finalizer on the object are given a chance to see that it has been marked for deletion. Once all controllers remove themselves from the finalizer list on the object, it is actually deleted by the garbage collector. Even with no finalizers, it may be a moment before the object is actually deleted.

You can check out https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers/ for more information.

If you want your Helm chart to actually wait for all the objects to be deleted before you try to reinstall, you should use the --wait flag on your helm delete command. If you don't do this, helm will start installing again while the objects are still in the process of being deleted by the apiserver. Helm will see that they exist initially, and try to update them, but then by the time it gets to updating them, the deletion has completed and it gets a "not found" error.

Ideally you would also use the --wait flag on your install command, to wait for your workload to roll out successfully before you try to uninstall it again.

@tibetsam
Copy link
Author

@brandond thanks for the tip. I think my problem is not bcz couldn't delete resources cleanly. I can even reproduce this issue on a fresh cluster. And from postgres logs we can see both insert with create and delete from api server.
Anyway, i will repeat the test with --wait command and get back you soon. Thanks again

@tibetsam
Copy link
Author

FYI, the issue exist with --wait command
~/yang-provider # for i in $(seq 1 20); do printf "\nINSTALLING, $i ITERATION\n"; helm install yang -n pc ./ --wait ; kubectl get configmap yang-provider-confd-config -n pc; echo "sleeping 5s"; sleep 5; echo "DELETING"; helm delete yang -n pc --wait; done

INSTALLING, 1 ITERATION
Error: INSTALLATION FAILED: cannot re-use a name that is still in use
NAME DATA AGE
yang-provider-confd-config 2 165m
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 2 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 17:48:30 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 3 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 17:48:38 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 4 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 17:48:46 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 5 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 17:48:53 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 0s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 6 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 17:49:01 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 7 ITERATION
Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found
sleeping 5s
DELETING
release "yang" uninstalled

INSTALLING, 8 ITERATION
NAME: yang
LAST DEPLOYED: Fri Oct 20 17:49:16 2023
NAMESPACE: pc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Service is deployed as yang-provider
NAME DATA AGE
yang-provider-confd-config 2 1s

@tibetsam
Copy link
Author

please note , the issue is not "not found", it is "already exist". :D

@brandond
Copy link
Member

brandond commented Oct 21, 2023

Error: INSTALLATION FAILED: configmaps "yang-provider-confd-config" already exists
Error from server (NotFound): configmaps "yang-provider-confd-config" not found

It looks to me like it still exists from the previous run, and then a moment later is gone. Postgres is one of the lower performance backends for kine for whatever reason, so I wouldn't be surprised if issues like this are easier to reproduce when using it.

I'll see if this can be reproduced without helm, but it really looks to me like a race condition in helm and not an issue with the apiserver or kine.

@tibetsam
Copy link
Author

It looks to me like it still exists from the previous run, and then a moment later is gone

but then it can't explain why this can happen on a fresh cluster, and here fresh means complete new VM and new k3s cluster.

I'll see if this can be reproduced without helm, but it really looks to me like a race condition in helm and not an issue with the apiserver or kine.

thanks, what i can also try is to put more delay in between and delete namespace and check resources before installing helm

@HawknHasLeftTheBuilding
Copy link

HawknHasLeftTheBuilding commented Oct 22, 2023

@brandond I have reproduced this issue with a modified version of the loadmap.py testscript from kine.
Currently testing with k3s-1.27.1+k3s1, but have earlier verified the issue exists on k3s-1.27.6+k3s1 as well.

Usually 10-50 creations out of 1000 fails with this script. Please let me know if you want any log files or other bits.

loadmap.py.gz

@tibetsam
Copy link
Author

Postgres is one of the lower performance backends for kine for whatever reason

@brandond could you please elaborate a little bit more on this one?

@brandond
Copy link
Member

brandond commented Oct 24, 2023

Usually 10-50 creations out of 1000 fails with this script

What version of postgres are you using, and in what sort of configuration? What are the specific errors you're getting?

could you please elaborate a little bit more on this one?

We run a full test suite against all the supported backends on every PR to Kine; you can find the perf figures in there for example see https://drone-pr.k3s.io/k3s-io/kine/276/1/3

I'm not sure why postgres is slower than some other engines when used as a Kine backend, but it is a frequent complaint that I hear. Folks have poked at it periodically but not made any significant difference as far as I know. For example see k3s-io/kine#78 and k3s-io/kine#151.

@brandond
Copy link
Member

brandond commented Oct 25, 2023

Oh, I see what you're doing. You modified the script to sequentially create configmaps, while deleting the configmap created 5 iterations prior. Sometimes when creating the configmap, an error is returned indicating that the configmap that you expected to have been previously deleted, still exists.

I was able to do a quick test just using postgres 13.2 running in Docker. A few interesting notes:

  • If you try to get the configmap that the apiserver claims exists, it will return a Not Found error, following which the create can be retried and will succeed.
  • Reducing the size of the configmap data seems to make this hard or impossible to reproduce.
  • Watching configmap events does not appear to show any deletes being skipped:
    kubectl get configmap -A --watch-only --output-watch-events
  • After several runs I see slow SQL warnings from k3s, and if I keep at it long enough it will eventually start complaining about compaction failing due to the compact transaction timing out and rolling back:
    INFO[0608] Slow SQL (started: 2023-10-25 00:19:12.901593252 +0000 UTC m=+602.473386863) (total time: 6.388648089s):  DELETE FROM kine AS kv USING ( SELECT kp.prev_revision AS id FROM kine AS kp WHERE kp.name != 'compact_rev_key' AND kp.prev_revision != 0 AND kp.id <= $1 UNION SELECT kd.id AS id FROM kine AS kd WHERE kd.deleted != 0 AND kd.id <= $2 ) AS ks WHERE kv.id = ks.id : [[3002 3002]]
    ERRO[0608] Compact failed: failed to record compact revision: sql: transaction has already been committed or rolled back
    

This feels to me like a slow datastore causing a cache somewhere in the apiserver to go stale, but it's hard to say where. This sounds very similar to an issue we've been tracking internally with watch events being missed in Kubernetes 1.27 and 1.28. We don't have an issue in GH yet but some basic logs from reproduction are available at https://gist.github.com/brandond/dd349d65d5afaf2e084e3d173d6c311e.
On the other hand I see v1.26 doing the same thing, so it is at least superficially the same issue.

Another possibility is that kine is affected by the GRPC watch stream starvation issue mentioned in #8415; I haven't had a chance to test to see whether or not removing the http mux from the kine listener makes any difference.

@brandond
Copy link
Member

Just out of curiosity I tried v1.23.6+k3s1 which was the last release that did not include k3s-io/kine#78, and it behaves the same... so that confirms that this is at least 1) not new behavior and 2) not made worse by that change.

@brandond brandond self-assigned this Oct 25, 2023
@brandond
Copy link
Member

brandond commented Oct 25, 2023

I'm going to tinker with changing the grpc mux, and fixing k3s-io/kine#215, and I'll see if I get any different behavior out of it.

@brandond
Copy link
Member

brandond commented Oct 25, 2023

OK, so I ran kine standalone with trace logging enabled and confirmed that the error is coming from postgres, NOT anything in the Kubernetes layer.

time="2023-10-25T16:43:11Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 true] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:11Z" level=trace msg="QUERY ROW [/registry/configmaps/load-test/test-051 1 0 0 584 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"
time="2023-10-25T16:43:11Z" level=trace msg="CREATE /registry/configmaps/load-test/test-051, size=131290, lease=0 => rev=787, err=<nil>"
time="2023-10-25T16:43:11Z" level=trace msg="TRIGGERED /registry/configmaps/load-test/test-051, revision=787, delete=false"
time="2023-10-25T16:43:11Z" level=trace msg="WATCH READ id=11, key=/registry/configmaps/load-test/test-051, revision=787"

time="2023-10-25T16:43:11Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 false] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC "
time="2023-10-25T16:43:11Z" level=trace msg="GET /registry/configmaps/load-test/test-051, rev=0 => rev=797, kv=true, err=<nil>"

time="2023-10-25T16:43:11Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 true] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:11Z" level=trace msg="QUERY ROW [/registry/configmaps/load-test/test-051 0 1 787 787 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"
time="2023-10-25T16:43:11Z" level=trace msg="DELETE /registry/configmaps/load-test/test-051, rev=787 => rev=798, kv=true, deleted=true, err=<nil>"
time="2023-10-25T16:43:11Z" level=trace msg="TRIGGERED /registry/configmaps/load-test/test-051, revision=798, delete=true"
time="2023-10-25T16:43:11Z" level=trace msg="WATCH READ id=11, key=/registry/configmaps/load-test/test-051, revision=798"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 true] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [/registry/configmaps/load-test/test-051 1 0 0 798 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"
time="2023-10-25T16:43:24Z" level=trace msg="CREATE /registry/configmaps/load-test/test-051, size=131290, lease=0 => rev=1007, err=rpc error: code = InvalidArgument desc = etcdserver: duplicate key given in txn request"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 false] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC "
time="2023-10-25T16:43:24Z" level=trace msg="GET /registry/configmaps/load-test/test-051, rev=0 => rev=1007, kv=false, err=<nil>"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 false] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC "
time="2023-10-25T16:43:24Z" level=trace msg="GET /registry/configmaps/load-test/test-051, rev=0 => rev=1007, kv=false, err=<nil>"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 true] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [/registry/configmaps/load-test/test-051 1 0 0 798 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"
time="2023-10-25T16:43:24Z" level=trace msg="CREATE /registry/configmaps/load-test/test-051, size=131290, lease=0 => rev=1008, err=<nil>"
time="2023-10-25T16:43:24Z" level=trace msg="TRIGGERED /registry/configmaps/load-test/test-051, revision=1008, delete=false"
time="2023-10-25T16:43:24Z" level=trace msg="WATCH READ id=11, key=/registry/configmaps/load-test/test-051, revision=1008"

We can see that kine is running the EXACT SAME query to create the row both times, but the first time postgres claims there's a "duplicate key". I first suspected that the duplicate key in question was for the name,prev_revision index but we know this can't be true because the same query succeeds the second time.

If we look at what's going on around this timeframe, we see kine complaining that the auto-increment primary key jumped forward at the exact same time we were trying to insert the row; kine responds by creating a "gap" record to ensure strict sequencing of event records.

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-045 true] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [/registry/configmaps/load-test/test-045 0 1 990 990 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"
time="2023-10-25T16:43:24Z" level=trace msg="DELETE /registry/configmaps/load-test/test-045, rev=990 => rev=1005, kv=true, deleted=true, err=<nil>"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY [% 1004] :  SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv WHERE kv.name LIKE $1 AND kv.id > $2 ORDER BY kv.id ASC LIMIT 500"
time="2023-10-25T16:43:24Z" level=trace msg="TRIGGERED /registry/configmaps/load-test/test-045, revision=1005, delete=true"
time="2023-10-25T16:43:24Z" level=trace msg="WATCH READ id=11, key=/registry/configmaps/load-test/test-045, revision=1005"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 true] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [/registry/configmaps/load-test/test-051 1 0 0 798 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/leases/kube-system/apiserver-lh46kuthsmhbsnvcyhx7sfkusm false] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC LIMIT 1"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [/registry/leases/kube-system/apiserver-lh46kuthsmhbsnvcyhx7sfkusm 0 0 37 849 0 [...] [...]] : INSERT INTO kine(name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8) RETURNING id"
time="2023-10-25T16:43:24Z" level=trace msg="UPDATE /registry/leases/kube-system/apiserver-lh46kuthsmhbsnvcyhx7sfkusm, value=593, rev=849, lease=0 => rev=1007, kvrev=1007, updated=true, err=<nil>"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [% 1005] :  SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv WHERE kv.name LIKE $1 AND kv.id > $2 ORDER BY kv.id ASC LIMIT 500"
time="2023-10-25T16:43:24Z" level=trace msg="MODREVISION GAP: expected 1006, got 1007"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [% 1005] :  SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv WHERE kv.name LIKE $1 AND kv.id > $2 ORDER BY kv.id ASC LIMIT 500"
time="2023-10-25T16:43:24Z" level=trace msg="MODREVISION GAP: expected 1006, got 1007"

time="2023-10-25T16:43:24Z" level=trace msg="EXEC (try: 0) [1006 gap-1006 0 1 0 0 0 <nil> <nil>] : INSERT INTO kine(id, name, created, deleted, create_revision, prev_revision, lease, value, old_value) values($1, $2, $3, $4, $5, $6, $7, $8, $9)"
time="2023-10-25T16:43:24Z" level=trace msg="FILL, revision=1006, err=<nil>"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [% 1005] :  SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv WHERE kv.name LIKE $1 AND kv.id > $2 ORDER BY kv.id ASC LIMIT 500"
time="2023-10-25T16:43:24Z" level=trace msg="NOT TRIGGER FILL gap-1006, revision=1006, delete=true"

time="2023-10-25T16:43:24Z" level=trace msg="TRIGGERED /registry/leases/kube-system/apiserver-lh46kuthsmhbsnvcyhx7sfkusm, revision=1007, delete=false"
time="2023-10-25T16:43:24Z" level=trace msg="WATCH READ id=24, key=/registry/leases/kube-system/apiserver-lh46kuthsmhbsnvcyhx7sfkusm, revision=1007"
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [] :  SELECT MAX(rkv.id) AS id FROM kine AS rkv"

time="2023-10-25T16:43:24Z" level=trace msg="CREATE /registry/configmaps/load-test/test-051, size=131290, lease=0 => rev=1007, err=rpc error: code = InvalidArgument desc = etcdserver: duplicate key given in txn request"

time="2023-10-25T16:43:24Z" level=trace msg="QUERY [/registry/configmaps/load-test/test-051 false] :  SELECT * FROM ( SELECT ( SELECT MAX(rkv.id) AS id FROM kine AS rkv), ( SELECT MAX(crkv.prev_revision) AS prev_revision FROM kine AS crkv WHERE crkv.name = 'compact_rev_key'), kv.id AS theid, kv.name, kv.created, kv.deleted, kv.create_revision, kv.prev_revision, kv.lease, kv.value, kv.old_value FROM kine AS kv JOIN ( SELECT MAX(mkv.id) AS id FROM kine AS mkv WHERE mkv.name LIKE $1 GROUP BY mkv.name) AS maxkv ON maxkv.id = kv.id WHERE kv.deleted = 0 OR $2 ) AS lkv ORDER BY lkv.theid ASC "
time="2023-10-25T16:43:24Z" level=trace msg="QUERY ROW [] :  SELECT MAX(rkv.id) AS id FROM kine AS rkv"
time="2023-10-25T16:43:24Z" level=trace msg="GET /registry/configmaps/load-test/test-051, rev=0 => rev=1007, kv=false, err=<nil>"

It appears that kine doesn't handle the slow insert properly, due to our expecting the database engine to enforce sequential inserts when using auto-increment primary keys.

  1. /registry/configmaps/load-test/test-045 was deleted (row id=1005)
  2. /registry/configmaps/load-test/test-051 was created (row id=1006)
  3. /registry/leases/kube-system/apiserver-lh46kuthsmhbsnvcyhx7sfkusm was updated (row id=1007)
  4. Kine expected the configmap create insert to complete before the lease update insert, since the queries were started in that order.
  5. Because the lease update insert finished first, kine saw the id jump forward, and created a gap-fill record with id=1006 to fill what it thought was a skipped auto-increment row id. Creation of this gap-fill record also completed while creation of /registry/configmaps/load-test/test-051 was still in progress.
  6. When the creation of /registry/configmaps/load-test/test-051 finally finished processing within postgres, id=1006 that postgres had been planning to use for that row was now taken by the gap record, and postgres returned a duplicate key error - despite the row id in question having been selected by postgres, NOT kine.

I'll have to do some research to figure out where this needs to be fixed. Apparently SERIAL PRIMARY KEY in postgres does not work the same as INTEGER AUTO_INCREMENT and INTEGER PRIMARY KEY AUTOINCREMENT on mysql and sqlite, which was our expectation.

@brandond
Copy link
Member

Apparently this is due to how postgres implements auto-increment using sequences - the next number in the sequence is retrieved at the start of the insert operation, but not used until the end. Other engines assign the auto-increment id at the end of the operation, based on the current max value of the row at the time the operation completes.

In the above example, sqlite and mysql would have assigned the row ids sequentially by the order they completed, not the order they started - and kine's expectations around linear ordering would be met.

I'm going to have to think about how to handle this without creating further performance regressions on postgres.

@tibetsam
Copy link
Author

tibetsam commented Oct 26, 2023

2023-10-20 15:02:26.232 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319122', $6 = '0', $7 = '
2023-10-20 15:02:26.246 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:26.599 UTC k3s k3s [17542]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:32.442 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:33.499 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 'f'
2023-10-20 15:02:33.695 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = 't'
2023-10-20 15:02:33.697 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319122', $6 = '0', $7 = '

@brandond thanks for the analysis, could you please help me to understand. why same id is used in my testcase? if we assume there was gap key inserted?
combining logs from api audit logs:
we can see this insert failed

2023-10-20 15:02:26.232 UTC k3s k3s [16979]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319122', $6 = '0', $7 = '

{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"9ce9f005-3e39-4e91-a254-aaff9296ed66","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"status":"Failure","message":"configmaps "yang-provider-confd-config" already exists","reason":"AlreadyExists","details":{"name":"yang-provider-confd-config","kind":"configmaps"},"code":409},"requestReceivedTimestamp":"2023-10-20T15:02:26.216425Z","stageTimestamp":"2023-10-20T15:02:26.247106Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}

and this one worked

2023-10-20 15:02:33.697 UTC k3s k3s [17863]DETAIL: parameters: $1 = '/registry/configmaps/pc/yang-provider-confd-config', $2 = '1', $3 = '0', $4 = '0', $5 = '1319122', $6 = '0', $7 = '

{"kind":"Event","apiVersion":"audit.k8s.io/v1","level":"Metadata","auditID":"2f3d09c8-7abc-4146-8ab2-5595b85c56d4","stage":"ResponseComplete","requestURI":"/api/v1/namespaces/pc/configmaps?fieldManager=helm","verb":"create","user":{"username":"system:admin","groups":["system:masters","system:authenticated"]},"sourceIPs":["10.10.202.1"],"userAgent":"Go-http-client/2.0","objectRef":{"resource":"configmaps","namespace":"pc","name":"yang-provider-confd-config","apiVersion":"v1"},"responseStatus":{"metadata":{},"code":201},"requestReceivedTimestamp":"2023-10-20T15:02:33.681942Z","stageTimestamp":"2023-10-20T15:02:33.712285Z","annotations":{"authorization.k8s.io/decision":"allow","authorization.k8s.io/reason":""}}

@brandond
Copy link
Member

brandond commented Oct 26, 2023

I stepped through the logic and logs above, and discussed the fix in comments within the linked PR.

I'm not sure what ID you're referring to. Are you talking about the create_revision field? That's just the current max revision at the time the entry is inserted. That's how the mvcc model works.

@VestigeJ
Copy link

This is painful to reproduce because it skirts the edge of what the nodes can handle resource wise but you can see some of the behavior here where pods are stuck terminating on the cluster. Reproducing this isn't very consistent but Brad's gist is very handy to do so.

https://gist.githubusercontent.com/brandond/595f80751b037e945f15ba64d3c798e9/raw/da5b48646e4560ddc94170704f6bb34663bd6ed8/main.go

observer-549b64c76b-bkds5   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-bkffs   1/1     Terminating         1               23m
observer-549b64c76b-bn5x5   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-bpxbx   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-bq2kf   0/1     Pending             0               23m
observer-549b64c76b-bs2t4   0/1     Pending             0               23m
observer-549b64c76b-bszw8   0/1     Pending             0               23m
observer-549b64c76b-bwlfd   0/1     Pending             0               23m
observer-549b64c76b-bz45t   0/1     Pending             0               23m
observer-549b64c76b-c2x7v   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-c4vgh   1/1     Running             0               23m
observer-549b64c76b-c548s   0/1     Pending             0               23m
observer-549b64c76b-c5jjn   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-c8fvz   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-c8zxq   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-c9gkc   0/1     Pending             0               23m
observer-549b64c76b-cc5wp   0/1     Pending             0               23m
observer-549b64c76b-cc6g5   0/1     Pending             0               23m
observer-549b64c76b-cgxf4   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-cjzsh   1/1     Terminating         0               23m
observer-549b64c76b-ck45w   1/1     Terminating         2               23m
observer-549b64c76b-clklv   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-cn2rk   0/1     Pending             0               23m
observer-549b64c76b-cnscf   0/1     Pending             0               23m
observer-549b64c76b-cqmf2   0/1     Pending             0               23m
observer-549b64c76b-cskzp   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-csx85   1/1     Running             0               23m
observer-549b64c76b-cvb69   1/1     Terminating         1               23m
observer-549b64c76b-cxjpn   0/1     Pending             0               23m
observer-549b64c76b-czc2g   0/1     Pending             0               23m
observer-549b64c76b-d44sm   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-d7j5g   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-d8bkh   1/1     Running             0               23m
observer-549b64c76b-d9chf   0/1     Pending             0               23m
observer-549b64c76b-d9frq   0/1     Pending             0               23m
observer-549b64c76b-db4v8   1/1     Terminating         1               23m
observer-549b64c76b-ddtpd   1/1     Terminating         0               23m
observer-549b64c76b-djlpm   1/1     Terminating         0               23m
observer-549b64c76b-djqq6   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-dkjs2   0/1     Pending             0               23m
observer-549b64c76b-dqntg   0/1     Pending             0               23m
observer-549b64c76b-dqpq7   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-dr85k   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-ds74x   0/1     Pending             0               23m
observer-549b64c76b-ds7sx   1/1     Terminating         0               23m
observer-549b64c76b-dwl9v   0/1     Pending             0               23m
observer-549b64c76b-dz7hl   1/1     Terminating         1               23m
observer-549b64c76b-dzxgt   1/1     Running             1               23m
observer-549b64c76b-f4gbk   1/1     Running             0               23m
observer-549b64c76b-f57g2   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-f8m62   0/1     Pending             0               23m
observer-549b64c76b-f9gfg   0/1     Pending             0               23m
observer-549b64c76b-fbqjn   0/1     Pending             0               23m
observer-549b64c76b-ffxnw   0/1     Pending             0               23m
observer-549b64c76b-fg4qh   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-fjmvw   0/1     Pending             0               23m
observer-549b64c76b-fk29k   1/1     Running             0               23m
observer-549b64c76b-flh8f   0/1     Pending             0               23m
observer-549b64c76b-fljmm   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-fmm4p   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-fpnjp   1/1     Terminating         0               23m
observer-549b64c76b-fqzxr   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-fvdxs   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-fvp65   0/1     Pending             0               23m
observer-549b64c76b-fvpdm   1/1     Terminating         0               23m
observer-549b64c76b-fwm9d   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-g55s6   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-g5pgv   1/1     Terminating         0               23m
observer-549b64c76b-g5thn   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-g7vtn   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-gbjn2   0/1     Pending             0               23m
observer-549b64c76b-ghptq   0/1     Pending             0               23m
observer-549b64c76b-gjgq7   0/1     Pending             0               23m
observer-549b64c76b-gjt4n   1/1     Terminating         0               23m
observer-549b64c76b-gjvdb   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-gkwfc   1/1     Terminating         0               23m
observer-549b64c76b-gs5zv   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-gtf72   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-gtk78   0/1     Pending             0               23m
observer-549b64c76b-gvxwl   0/1     Pending             0               23m
observer-549b64c76b-gx7qq   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-h2g9l   1/1     Terminating         1               23m
observer-549b64c76b-h5gfj   0/1     ContainerCreating   0               23m
observer-549b64c76b-h5sgt   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-h5tkl   1/1     Terminating         1               23m
observer-549b64c76b-h6mvd   0/1     Pending             0               23m
observer-549b64c76b-h8kdg   1/1     Terminating         1               23m
observer-549b64c76b-h9df6   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-hcd78   0/1     Pending             0               23m
observer-549b64c76b-hdbrg   1/1     Terminating         0               23m
observer-549b64c76b-hdr25   1/1     Terminating         0               23m
observer-549b64c76b-hjb7d   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-hjsms   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-hnlww   0/1     Pending             0               23m
observer-549b64c76b-hnmhq   1/1     Running             0               23m
observer-549b64c76b-hp6kc   1/1     Running             1 (17m ago)     23m
observer-549b64c76b-hq4cs   0/1     Pending             0               23m
observer-549b64c76b-hrkgj   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-hskll   0/1     Pending             0               23m
observer-549b64c76b-htsgf   1/1     Terminating         0               23m
observer-549b64c76b-hvl6k   1/1     Running             0               23m
observer-549b64c76b-hvrv9   0/1     ContainerCreating   0               23m
observer-549b64c76b-j2g9w   1/1     Terminating         2               23m
observer-549b64c76b-j44h5   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-j7dfl   0/1     ContainerCreating   0               23m
observer-549b64c76b-j8444   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-j8dpx   0/1     Pending             0               23m
observer-549b64c76b-j8fbr   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-j9854   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-j9w5b   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-jck8l   1/1     Terminating         0               23m
observer-549b64c76b-jcvgm   0/1     Pending             0               23m
observer-549b64c76b-jdr7q   0/1     Pending             0               23m
observer-549b64c76b-jdrfl   1/1     Terminating         0               23m
observer-549b64c76b-jdz4l   0/1     Pending             0               23m
observer-549b64c76b-jg5gj   0/1     Pending             0               23m
observer-549b64c76b-jgcv9   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-jggtq   0/1     Pending             0               23m
observer-549b64c76b-jhgk4   1/1     Terminating         0               23m
observer-549b64c76b-jhnr6   1/1     Running             0               23m
observer-549b64c76b-jjjbr   0/1     Pending             0               23m
observer-549b64c76b-jlmwf   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-jp2qp   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-jpbr7   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-jr49r   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-jsxxk   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-jtvm5   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-jw5vv   1/1     Terminating         0               23m
observer-549b64c76b-jxslx   0/1     Pending             0               23m
observer-549b64c76b-jzrc6   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-k4fww   0/1     Pending             0               23m
observer-549b64c76b-k6gf4   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-k8976   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-k9jp8   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-k9szt   0/1     Pending             0               23m
observer-549b64c76b-kb2rc   0/1     Pending             0               23m
observer-549b64c76b-kbh7h   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-kbrzp   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-kdxpf   0/1     Pending             0               23m
observer-549b64c76b-kfmj7   0/1     Pending             0               23m
observer-549b64c76b-kg5bs   0/1     ContainerCreating   0               23m
observer-549b64c76b-kgsh7   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-kgtbc   0/1     Pending             0               23m
observer-549b64c76b-kh25z   0/1     Pending             0               23m
observer-549b64c76b-kl7n9   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-klh8x   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-kpp75   1/1     Terminating         0               23m
observer-549b64c76b-kqgxr   0/1     Pending             0               23m
observer-549b64c76b-ks28n   0/1     Pending             0               23m
observer-549b64c76b-ktczp   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-kvl8f   1/1     Terminating         1               23m
observer-549b64c76b-kvm72   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-kxmj4   0/1     Pending             0               23m
observer-549b64c76b-l4mjf   0/1     Pending             0               23m
observer-549b64c76b-l7lpg   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-l8tv8   1/1     Terminating         0               23m
observer-549b64c76b-l9qz7   0/1     Pending             0               23m
observer-549b64c76b-lfpsh   1/1     Terminating         1               23m
observer-549b64c76b-ljwrp   0/1     Pending             0               23m
observer-549b64c76b-lpmqh   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-lpqlj   0/1     Pending             0               23m
observer-549b64c76b-lps9j   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-ls5f9   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-lt2pj   1/1     Terminating         0               23m
observer-549b64c76b-lvwm8   0/1     Pending             0               23m
observer-549b64c76b-lw8lz   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-lwhbd   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-lxrfq   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-lzgqm   0/1     Pending             0               23m
observer-549b64c76b-m58jr   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-m5rhp   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-m5rww   0/1     ContainerCreating   0               23m
observer-549b64c76b-m8plr   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-m9s6g   0/1     ContainerCreating   0               23m
observer-549b64c76b-mfb2z   0/1     Pending             0               23m
observer-549b64c76b-mfq7g   0/1     Pending             0               23m
observer-549b64c76b-mggtp   0/1     Pending             0               23m
observer-549b64c76b-mn7b4   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-mpk5d   1/1     Terminating         1               23m
observer-549b64c76b-mr5cr   1/1     Terminating         0               23m
observer-549b64c76b-mtc9b   0/1     Pending             0               23m
observer-549b64c76b-mzbrt   1/1     Running             0               23m
observer-549b64c76b-n4mjg   1/1     Running             0               23m
observer-549b64c76b-n8wrc   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-n9srr   0/1     ContainerCreating   0               23m
observer-549b64c76b-nbdr8   0/1     Pending             0               23m
observer-549b64c76b-ndtdg   0/1     Pending             0               23m
observer-549b64c76b-ng4r7   0/1     Pending             0               23m
observer-549b64c76b-ngtkc   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-njtgj   0/1     Pending             0               23m
observer-549b64c76b-nl9mc   1/1     Terminating         1               23m
observer-549b64c76b-nqkpc   1/1     Running             1 (17m ago)     23m
observer-549b64c76b-nqzmh   1/1     Running             0               23m
observer-549b64c76b-nr9bk   0/1     Pending             0               23m
observer-549b64c76b-nrb8h   1/1     Running             0               23m
observer-549b64c76b-nsvtr   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-nt27n   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-ntwlm   1/1     Terminating         0               23m
observer-549b64c76b-nvmkb   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-nwzmh   0/1     Pending             0               23m
observer-549b64c76b-p2zvt   0/1     Pending             0               23m
observer-549b64c76b-p4c45   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-p5sn6   0/1     Pending             0               23m
observer-549b64c76b-p6rxl   0/1     Pending             0               23m
observer-549b64c76b-p6w5b   1/1     Running             0               23m
observer-549b64c76b-pbtdp   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-pc6q7   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-pjbqk   0/1     Pending             0               23m
observer-549b64c76b-pm9gp   0/1     Pending             0               23m
observer-549b64c76b-pmd2w   0/1     Pending             0               23m
observer-549b64c76b-pnwgh   0/1     ContainerCreating   0               23m
observer-549b64c76b-prln9   0/1     Pending             0               23m
observer-549b64c76b-prsns   1/1     Terminating         0               23m
observer-549b64c76b-ptjhr   0/1     Pending             0               23m
observer-549b64c76b-pw5zx   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-pwl58   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-q27zh   0/1     Pending             0               23m
observer-549b64c76b-q2q9z   0/1     Pending             0               23m
observer-549b64c76b-q5rpb   0/1     Pending             0               23m
observer-549b64c76b-q6262   0/1     Pending             0               23m
observer-549b64c76b-q6qss   1/1     Terminating         0               23m
observer-549b64c76b-q74w8   1/1     Running             0               23m
observer-549b64c76b-q8vsp   0/1     Pending             0               23m
observer-549b64c76b-q9s8s   0/1     Pending             0               23m
observer-549b64c76b-qhq7g   1/1     Terminating         0               23m
observer-549b64c76b-ql679   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-qlvvj   0/1     Pending             0               23m
observer-549b64c76b-qph9d   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-qqnwm   0/1     Pending             0               23m
observer-549b64c76b-qr4cg   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-qw9ws   0/1     Pending             0               23m
observer-549b64c76b-qxpqj   1/1     Terminating         0               23m
observer-549b64c76b-qzz86   0/1     Pending             0               23m
observer-549b64c76b-r49d8   1/1     Running             0               23m
observer-549b64c76b-r4bl2   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-r4cjb   1/1     Terminating         1               23m
observer-549b64c76b-r4qp6   1/1     Terminating         0               23m
observer-549b64c76b-r7ts9   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-r9fm7   1/1     Terminating         1               23m
observer-549b64c76b-rcd9k   0/1     Pending             0               23m
observer-549b64c76b-rcpck   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-rf5kf   0/1     Pending             0               23m
observer-549b64c76b-rgbmh   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-rj4n4   0/1     Pending             0               23m
observer-549b64c76b-rk5b6   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-rk7b9   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-rllz8   1/1     Terminating         1               23m
observer-549b64c76b-rpvfp   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-rqs7g   1/1     Terminating         0               23m
observer-549b64c76b-rtwj5   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-s26xn   0/1     Pending             0               23m
observer-549b64c76b-s2ct7   0/1     Pending             0               23m
observer-549b64c76b-s2hjx   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-s58cf   0/1     Pending             0               23m
observer-549b64c76b-s6xhj   0/1     Pending             0               23m
observer-549b64c76b-s778p   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-s889z   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-s9v5d   1/1     Running             0               23m
observer-549b64c76b-sc7r8   0/1     ContainerCreating   0               23m
observer-549b64c76b-scvf4   0/1     Pending             0               23m
observer-549b64c76b-sdpml   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-sfdhx   0/1     Pending             0               23m
observer-549b64c76b-sfnfx   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-sfswb   0/1     Pending             0               23m
observer-549b64c76b-sgp92   0/1     Pending             0               23m
observer-549b64c76b-sgrvc   0/1     Pending             0               23m
observer-549b64c76b-sjf82   1/1     Terminating         1               23m
observer-549b64c76b-sjnxl   0/1     Pending             0               23m
observer-549b64c76b-sl42m   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-slfzp   1/1     Terminating         1               23m
observer-549b64c76b-snlrw   0/1     Pending             0               23m
observer-549b64c76b-snwbj   1/1     Terminating         0               23m
observer-549b64c76b-sqgv6   0/1     Pending             0               23m
observer-549b64c76b-sr5lv   0/1     Pending             0               23m
observer-549b64c76b-sz9mc   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-t246w   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-t44dm   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-t4scc   1/1     Terminating         1               23m
observer-549b64c76b-t5p8x   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-t6lfp   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-t6wk6   1/1     Running             0               23m
observer-549b64c76b-t7cq6   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-t87fb   0/1     Pending             0               23m
observer-549b64c76b-t9dfz   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-tcps5   0/1     ContainerCreating   0               23m
observer-549b64c76b-tcrdt   1/1     Running             0               23m
observer-549b64c76b-tfq2j   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-tg8zg   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-tkf7l   0/1     Pending             0               23m
observer-549b64c76b-tkfmn   1/1     Terminating         0               23m
observer-549b64c76b-tkl78   1/1     Terminating         1               23m
observer-549b64c76b-tm59p   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-tmlwx   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-tpsq6   0/1     Pending             0               23m
observer-549b64c76b-tqxnz   0/1     Pending             0               23m
observer-549b64c76b-trt2k   0/1     Pending             0               23m
observer-549b64c76b-v2p4d   1/1     Running             0               43m
observer-549b64c76b-v4bjw   1/1     Running             0               23m
observer-549b64c76b-v4fh9   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-v64p4   1/1     Terminating         1               23m
observer-549b64c76b-v8zd7   0/1     Pending             0               23m
observer-549b64c76b-vdplg   1/1     Running             0               23m
observer-549b64c76b-vgdgp   1/1     Running             0               23m
observer-549b64c76b-vjdkz   1/1     Terminating         1               23m
observer-549b64c76b-vjmlj   0/1     Pending             0               23m
observer-549b64c76b-vjr8z   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-vmz9c   1/1     Running             1 (17m ago)     23m
observer-549b64c76b-vndh8   0/1     Pending             0               23m
observer-549b64c76b-vp2r7   1/1     Terminating         2               23m
observer-549b64c76b-vqxz8   0/1     ContainerCreating   0               23m
observer-549b64c76b-vshmk   0/1     Pending             0               23m
observer-549b64c76b-vskvn   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-vvb5c   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-vwlvv   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-w6w4d   0/1     Pending             0               23m
observer-549b64c76b-w959j   1/1     Terminating         1               23m
observer-549b64c76b-w9h8j   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-wbvbq   1/1     Terminating         0               23m
observer-549b64c76b-wc98x   0/1     Pending             0               23m
observer-549b64c76b-wfjt2   0/1     Pending             0               23m
observer-549b64c76b-wjf2t   1/1     Terminating         2               23m
observer-549b64c76b-wnm2f   0/1     Pending             0               23m
observer-549b64c76b-wv8kl   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-wwrst   0/1     Pending             0               23m
observer-549b64c76b-wwzsb   1/1     Terminating         0               23m
observer-549b64c76b-x46hv   1/1     Terminating         2               23m
observer-549b64c76b-x4m82   0/1     Pending             0               23m
observer-549b64c76b-x5h9q   0/1     ContainerCreating   0               23m
observer-549b64c76b-x5nbj   0/1     ContainerCreating   0               23m
observer-549b64c76b-x5p89   0/1     Pending             0               23m
observer-549b64c76b-x5qdq   1/1     Running             0               43m
observer-549b64c76b-x6jr2   1/1     Terminating         0               23m
observer-549b64c76b-x7r7f   0/1     Pending             0               23m
observer-549b64c76b-x8t4p   0/1     Pending             0               23m
observer-549b64c76b-x9n6s   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-xcnqf   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-xgfzw   1/1     Terminating         1               23m
observer-549b64c76b-xhqgw   0/1     Pending             0               23m
observer-549b64c76b-xhwhl   1/1     Terminating         1 (17m ago)     23m
observer-549b64c76b-xjsfr   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-xn5mm   0/1     Pending             0               23m
observer-549b64c76b-xp74j   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-xrv88   1/1     Terminating         1               23m
observer-549b64c76b-xtgnx   1/1     Terminating         0               23m
observer-549b64c76b-xvdvb   0/1     ContainerCreating   0               23m
observer-549b64c76b-xvhct   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-xvn9m   0/1     Pending             0               23m
observer-549b64c76b-xxh2m   0/1     Pending             0               23m
observer-549b64c76b-z2hsh   1/1     Running             1 (4m34s ago)   23m
observer-549b64c76b-z2q76   1/1     Running             1 (5m5s ago)    23m
observer-549b64c76b-z4w7j   0/1     Pending             0               23m
observer-549b64c76b-z78fm   1/1     Terminating         1               23m
observer-549b64c76b-z7jcn   0/1     Pending             0               23m
observer-549b64c76b-z867t   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-zcjgl   1/1     Terminating         1 (4m34s ago)   23m
observer-549b64c76b-zcnqw   0/1     Pending             0               23m
observer-549b64c76b-zfngc   0/1     Pending             0               23m
observer-549b64c76b-znhzx   1/1     Terminating         1 (5m5s ago)    23m
observer-549b64c76b-zp7rn   0/1     Pending             0               23m
observer-549b64c76b-zswhj   1/1     Terminating         1               23m
observer-549b64c76b-zx8hn   1/1     Terminating         1 (4m34s ago)   23m

##Environment Details
Reproduced using VERSION=v1.28.3+k3s2

Infrastructure

  • Cloud

Node(s) CPU architecture, OS, and version:

Linux 5.14.21-150500.53-default x86_64 GNU/Linux
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5"

Cluster Configuration:

NAME              STATUS   ROLES                       AGE   VERSION
ip-1-1-1-27       Ready    control-plane,etcd,master   87m   v1.28.3+k3s2
ip-1-1-1-50       Ready    <none>                      87m   v1.28.3+k3s2
ip-1-1-1-6        Ready    control-plane,etcd,master   87m   v1.28.3+k3s2
ip-1-1-1-34       Ready    control-plane,etcd,master   88m   v1.28.3+k3s2

Config.yaml:

server: https://3.1.1.1:6443
write-kubeconfig-mode: 644
debug: true
token: YOUR_TOKEN_HERE
profile: cis
selinux: true
protect-kernel-defaults: true
kubelet-arg:
  - max-pods=250
kube-controller-manager-arg:
  - node-cidr-mask-size=22

Pods stuck terminating after scaling down the deployment

$ curl https://get.k3s.io --output install-"k3s".sh
$ sudo chmod +x install-"k3s".sh
$ sudo groupadd --system etcd && sudo useradd -s /sbin/nologin --system -g etcd etcd
$ sudo modprobe ip_vs_rr
$ sudo modprobe ip_vs_wrr
$ sudo modprobe ip_vs_sh
$ sudo printf "on_oovm.panic_on_oom=0 \nvm.overcommit_memory=1 \nkernel.panic=10 \nkernel.panic_ps=1 \nkernel.panic_on_oops=1 \n" > ~/90-kubelet.conf
$ sudo cp 90-kubelet.conf /etc/sysctl.d/
$ sudo systemctl restart systemd-sysctl
$ wget https://gist.githubusercontent.com/brandond/595f80751b037e945f15ba64d3c798e9/raw/da5b48646e4560ddc94170704f6bb34663bd6ed8/nginx.yaml
$ wget https://gist.githubusercontent.com/brandond/595f80751b037e945f15ba64d3c798e9/raw/da5b48646e4560ddc94170704f6bb34663bd6ed8/observer.yaml
$ sudo INSTALL_K3S_VERSION=v1.28.3+k3s2 INSTALL_K3S_EXEC=server ./install-k3s.sh
$ set_kubefig
$ kgn //wait for nodes to be ready
$ k create -f nginx.yaml -f observer.yaml
$ kgp -n test
$ k scale deploy observer --replicas=450 -n test //wait for pods to run then scale down sharply -- there is a high chance your nodes will become unreachable 
$ kgp -n test
$ k scale deploy observer --replicas=4 -n test

Results:

@VestigeJ
Copy link

Longer running error example

$ kgn

NAME              STATUS     ROLES                       AGE     VERSION
ip-1-1-1-27       Ready      control-plane,etcd,master   4h11m   v1.28.3+k3s2
ip-1-1-1-50       NotReady   <none>                      4h12m   v1.28.3+k3s2
ip-1-1-1-6        NotReady   control-plane,etcd,master   4h11m   v1.28.3+k3s2
ip-1-1-1-34       Ready      control-plane,etcd,master   4h12m   v1.28.3+k3s2

$ kgp -n test

NAME                        READY   STATUS        RESTARTS       AGE
nginx-pod-1                 1/1     Terminating   0              4h9m
nginx-pod-10                1/1     Running       1 (169m ago)   4h9m
nginx-pod-100               1/1     Terminating   0              4h9m
nginx-pod-101               1/1     Terminating   0              4h9m
nginx-pod-102               1/1     Running       1 (169m ago)   4h9m
nginx-pod-103               1/1     Running       1 (169m ago)   4h9m
nginx-pod-104               1/1     Running       1 (169m ago)   4h9m
nginx-pod-105               1/1     Terminating   0              4h9m
nginx-pod-106               1/1     Terminating   0              4h9m
nginx-pod-107               1/1     Running       1 (169m ago)   4h9m
nginx-pod-108               1/1     Terminating   0              4h9m
nginx-pod-109               1/1     Terminating   0              4h9m
nginx-pod-11                1/1     Terminating   0              4h9m
nginx-pod-110               1/1     Terminating   0              4h9m
nginx-pod-12                1/1     Terminating   0              4h9m
nginx-pod-13                1/1     Terminating   0              4h9m
nginx-pod-14                1/1     Running       1              4h9m
nginx-pod-15                1/1     Terminating   0              4h9m
nginx-pod-16                1/1     Running       1 (170m ago)   4h9m
nginx-pod-17                1/1     Running       1 (169m ago)   4h9m
nginx-pod-18                1/1     Terminating   0              4h9m
nginx-pod-19                1/1     Terminating   0              4h9m
nginx-pod-2                 1/1     Running       1 (169m ago)   4h9m
nginx-pod-20                1/1     Running       1 (170m ago)   4h9m
nginx-pod-21                1/1     Terminating   0              4h9m
nginx-pod-22                1/1     Terminating   0              4h9m
nginx-pod-23                1/1     Running       1              4h9m
nginx-pod-24                1/1     Running       1 (170m ago)   4h9m
nginx-pod-25                1/1     Terminating   0              4h9m
nginx-pod-26                1/1     Running       1              4h9m
nginx-pod-27                1/1     Terminating   0              4h9m
nginx-pod-28                1/1     Running       1 (170m ago)   4h9m
nginx-pod-29                1/1     Terminating   0              4h9m
nginx-pod-3                 1/1     Terminating   0              4h9m
nginx-pod-30                1/1     Running       1 (169m ago)   4h9m
nginx-pod-31                1/1     Terminating   0              4h9m
nginx-pod-32                1/1     Running       1 (170m ago)   4h9m
nginx-pod-33                1/1     Running       1 (169m ago)   4h9m
nginx-pod-34                1/1     Terminating   0              4h9m
nginx-pod-35                1/1     Terminating   0              4h9m
nginx-pod-36                1/1     Running       1 (170m ago)   4h9m
nginx-pod-37                1/1     Terminating   0              4h9m
nginx-pod-38                1/1     Terminating   0              4h9m
nginx-pod-39                1/1     Running       1 (169m ago)   4h9m
nginx-pod-4                 1/1     Terminating   0              4h9m
nginx-pod-40                1/1     Running       1 (170m ago)   4h9m
nginx-pod-41                1/1     Running       1 (169m ago)   4h9m
nginx-pod-42                1/1     Terminating   0              4h9m
nginx-pod-43                1/1     Terminating   0              4h9m
nginx-pod-44                1/1     Running       1 (170m ago)   4h9m
nginx-pod-45                1/1     Terminating   0              4h9m
nginx-pod-46                1/1     Running       1 (169m ago)   4h9m
nginx-pod-47                1/1     Terminating   0              4h9m
nginx-pod-48                1/1     Running       1 (170m ago)   4h9m
nginx-pod-49                1/1     Terminating   0              4h9m
nginx-pod-5                 1/1     Running       1 (169m ago)   4h9m
nginx-pod-50                1/1     Terminating   0              4h9m
nginx-pod-51                1/1     Running       1 (169m ago)   4h9m
nginx-pod-52                1/1     Running       1 (170m ago)   4h9m
nginx-pod-53                1/1     Terminating   0              4h9m
nginx-pod-54                1/1     Terminating   0              4h9m
nginx-pod-55                1/1     Running       1 (169m ago)   4h9m
nginx-pod-56                1/1     Running       1 (170m ago)   4h9m
nginx-pod-57                1/1     Terminating   0              4h9m
nginx-pod-58                1/1     Running       1 (169m ago)   4h9m
nginx-pod-59                1/1     Terminating   0              4h9m
nginx-pod-6                 1/1     Running       1 (169m ago)   4h9m
nginx-pod-60                1/1     Running       1 (170m ago)   4h9m
nginx-pod-61                1/1     Running       1 (170m ago)   4h9m
nginx-pod-62                1/1     Terminating   0              4h9m
nginx-pod-63                1/1     Running       1 (169m ago)   4h9m
nginx-pod-64                1/1     Terminating   0              4h9m
nginx-pod-65                1/1     Running       1 (169m ago)   4h9m
nginx-pod-66                1/1     Running       1 (169m ago)   4h9m
nginx-pod-67                1/1     Terminating   0              4h9m
nginx-pod-68                1/1     Terminating   0              4h9m
nginx-pod-69                1/1     Terminating   0              4h9m
nginx-pod-7                 1/1     Terminating   0              4h9m
nginx-pod-70                1/1     Terminating   0              4h9m
nginx-pod-71                1/1     Terminating   0              4h9m
nginx-pod-72                1/1     Terminating   0              4h9m
nginx-pod-73                1/1     Running       1 (169m ago)   4h9m
nginx-pod-74                1/1     Terminating   0              4h9m
nginx-pod-75                1/1     Running       1              4h9m
nginx-pod-76                1/1     Terminating   0              4h9m
nginx-pod-77                1/1     Terminating   0              4h9m
nginx-pod-78                1/1     Terminating   0              4h9m
nginx-pod-79                1/1     Terminating   0              4h9m
nginx-pod-8                 1/1     Terminating   0              4h9m
nginx-pod-80                1/1     Terminating   0              4h9m
nginx-pod-81                1/1     Terminating   0              4h9m
nginx-pod-82                1/1     Terminating   0              4h9m
nginx-pod-83                1/1     Running       1 (169m ago)   4h9m
nginx-pod-84                1/1     Terminating   0              4h9m
nginx-pod-85                1/1     Terminating   0              4h9m
nginx-pod-86                1/1     Terminating   0              4h9m
nginx-pod-87                1/1     Terminating   0              4h9m
nginx-pod-88                1/1     Terminating   0              4h9m
nginx-pod-89                1/1     Terminating   0              4h9m
nginx-pod-9                 1/1     Running       1 (170m ago)   4h9m
nginx-pod-90                1/1     Running       1 (169m ago)   4h9m
nginx-pod-91                1/1     Running       1 (169m ago)   4h9m
nginx-pod-92                1/1     Terminating   0              4h9m
nginx-pod-93                1/1     Running       1 (169m ago)   4h9m
nginx-pod-94                1/1     Running       1 (169m ago)   4h9m
nginx-pod-95                1/1     Terminating   0              4h9m
nginx-pod-96                1/1     Running       1 (169m ago)   4h9m
nginx-pod-97                1/1     Terminating   0              4h9m
nginx-pod-98                1/1     Terminating   0              4h9m
nginx-pod-99                1/1     Terminating   0              4h9m
observer-549b64c76b-22dlj   0/1     Terminating   0              3h8m
observer-549b64c76b-24kvd   1/1     Terminating   0              3h8m
observer-549b64c76b-29h49   0/1     Terminating   0              3h8m
observer-549b64c76b-2nsdw   0/1     Terminating   0              3h8m
observer-549b64c76b-2xhnp   0/1     Terminating   0              3h8m
observer-549b64c76b-45lgq   1/1     Terminating   0              3h28m
observer-549b64c76b-46cfv   0/1     Terminating   0              3h8m
observer-549b64c76b-4cq6m   1/1     Terminating   0              3h8m
observer-549b64c76b-4gfvd   0/1     Terminating   0              3h8m
observer-549b64c76b-4lkkt   0/1     Terminating   0              3h8m
observer-549b64c76b-4r9mk   0/1     Terminating   0              3h8m
observer-549b64c76b-4rqhn   0/1     Terminating   0              3h8m
observer-549b64c76b-4vljn   0/1     Terminating   0              3h8m
observer-549b64c76b-4wxqp   0/1     Terminating   0              3h8m
observer-549b64c76b-525ff   0/1     Terminating   0              3h8m
observer-549b64c76b-5cxw6   0/1     Terminating   0              3h8m
observer-549b64c76b-5dgwq   0/1     Terminating   0              3h8m
observer-549b64c76b-5g4vp   0/1     Terminating   0              3h8m
observer-549b64c76b-5hbq2   0/1     Terminating   0              3h8m
observer-549b64c76b-5mxg9   0/1     Terminating   0              3h8m
observer-549b64c76b-5qrnk   0/1     Terminating   0              3h8m
observer-549b64c76b-5qrw9   0/1     Terminating   0              3h8m
observer-549b64c76b-64bgt   1/1     Terminating   0              3h28m
observer-549b64c76b-695hg   0/1     Terminating   0              3h8m
observer-549b64c76b-6lhxb   0/1     Terminating   0              3h8m
observer-549b64c76b-6tclg   0/1     Terminating   0              3h8m
observer-549b64c76b-6x8r5   0/1     Terminating   0              3h8m
observer-549b64c76b-6z7lj   0/1     Terminating   0              3h8m
observer-549b64c76b-7492x   0/1     Terminating   0              3h8m
observer-549b64c76b-74g22   0/1     Terminating   0              3h8m
observer-549b64c76b-754fb   0/1     Terminating   0              3h8m
observer-549b64c76b-78lnw   0/1     Terminating   0              3h8m
observer-549b64c76b-7bncg   0/1     Terminating   0              3h8m
observer-549b64c76b-7jxb6   0/1     Terminating   0              3h8m
observer-549b64c76b-7mmkj   0/1     Terminating   0              3h8m
observer-549b64c76b-7mpwd   0/1     Terminating   0              3h8m
observer-549b64c76b-7t686   0/1     Terminating   0              3h8m
observer-549b64c76b-7w76m   0/1     Terminating   0              3h8m
observer-549b64c76b-7wb2j   0/1     Terminating   0              3h8m
observer-549b64c76b-895cb   0/1     Terminating   0              3h8m
observer-549b64c76b-8d8q5   0/1     Terminating   0              3h8m
observer-549b64c76b-8jmbn   0/1     Terminating   0              3h8m
observer-549b64c76b-8jvrn   0/1     Terminating   0              3h8m
observer-549b64c76b-8mjhp   0/1     Terminating   0              3h8m
observer-549b64c76b-8n4m2   0/1     Terminating   0              3h8m
observer-549b64c76b-8qvf7   0/1     Terminating   0              3h8m
observer-549b64c76b-8r49v   1/1     Terminating   0              3h8m
observer-549b64c76b-8sm4l   0/1     Terminating   0              3h8m
observer-549b64c76b-8xps8   0/1     Terminating   0              3h8m
observer-549b64c76b-94d78   0/1     Terminating   0              3h8m
observer-549b64c76b-9gttb   0/1     Terminating   0              3h8m
observer-549b64c76b-9v9pv   0/1     Terminating   0              3h8m
observer-549b64c76b-9wwgt   0/1     Terminating   0              3h8m
observer-549b64c76b-b9xff   0/1     Terminating   0              3h8m
observer-549b64c76b-b9zqm   0/1     Terminating   0              3h8m
observer-549b64c76b-bbznl   0/1     Terminating   0              3h8m
observer-549b64c76b-bffvb   0/1     Terminating   0              3h8m
observer-549b64c76b-bgqt5   0/1     Terminating   0              3h8m
observer-549b64c76b-bh2rt   0/1     Terminating   0              3h8m
observer-549b64c76b-bq2kf   0/1     Terminating   0              3h8m
observer-549b64c76b-bs2t4   0/1     Terminating   0              3h8m
observer-549b64c76b-bszw8   0/1     Terminating   0              3h8m
observer-549b64c76b-bwlfd   0/1     Terminating   0              3h8m
observer-549b64c76b-bz45t   0/1     Terminating   0              3h8m
observer-549b64c76b-c548s   0/1     Terminating   0              3h8m
observer-549b64c76b-c9gkc   0/1     Terminating   0              3h8m
observer-549b64c76b-cc5wp   0/1     Terminating   0              3h8m
observer-549b64c76b-cc6g5   0/1     Terminating   0              3h8m
observer-549b64c76b-cjzsh   1/1     Terminating   0              3h8m
observer-549b64c76b-cn2rk   0/1     Terminating   0              3h8m
observer-549b64c76b-cnscf   0/1     Terminating   0              3h8m
observer-549b64c76b-cqmf2   0/1     Terminating   0              3h8m
observer-549b64c76b-csx85   1/1     Running       0              3h8m
observer-549b64c76b-cxjpn   0/1     Terminating   0              3h8m
observer-549b64c76b-czc2g   0/1     Terminating   0              3h8m
observer-549b64c76b-d9chf   0/1     Terminating   0              3h8m
observer-549b64c76b-d9frq   0/1     Terminating   0              3h8m
observer-549b64c76b-djlpm   1/1     Terminating   0              3h8m
observer-549b64c76b-dkjs2   0/1     Terminating   0              3h8m
observer-549b64c76b-dqntg   0/1     Terminating   0              3h8m
observer-549b64c76b-ds74x   0/1     Terminating   0              3h8m
observer-549b64c76b-dwl9v   0/1     Terminating   0              3h8m
observer-549b64c76b-f4gbk   1/1     Terminating   0              3h8m
observer-549b64c76b-f8m62   0/1     Terminating   0              3h8m
observer-549b64c76b-f9gfg   0/1     Terminating   0              3h8m
observer-549b64c76b-fbqjn   0/1     Terminating   0              3h8m
observer-549b64c76b-ffxnw   0/1     Terminating   0              3h8m
observer-549b64c76b-fjmvw   0/1     Terminating   0              3h8m
observer-549b64c76b-flh8f   0/1     Terminating   0              3h8m
observer-549b64c76b-fvp65   0/1     Terminating   0              3h8m
observer-549b64c76b-gbjn2   0/1     Terminating   0              3h8m
observer-549b64c76b-ghptq   0/1     Terminating   0              3h8m
observer-549b64c76b-gjgq7   0/1     Terminating   0              3h8m
observer-549b64c76b-gtk78   0/1     Terminating   0              3h8m
observer-549b64c76b-gvxwl   0/1     Terminating   0              3h8m
observer-549b64c76b-h5gfj   0/1     Terminating   0              3h8m
observer-549b64c76b-hcd78   0/1     Terminating   0              3h8m
observer-549b64c76b-hnlww   0/1     Terminating   0              3h8m
observer-549b64c76b-hq4cs   0/1     Terminating   0              3h8m
observer-549b64c76b-hskll   0/1     Terminating   0              3h8m
observer-549b64c76b-hvl6k   1/1     Terminating   0              3h8m
observer-549b64c76b-hvrv9   0/1     Terminating   0              3h8m
observer-549b64c76b-j7dfl   0/1     Terminating   0              3h8m
observer-549b64c76b-j8dpx   0/1     Terminating   0              3h8m
observer-549b64c76b-jck8l   1/1     Terminating   0              3h8m
observer-549b64c76b-jcvgm   0/1     Terminating   0              3h8m
observer-549b64c76b-jdr7q   0/1     Terminating   0              3h8m
observer-549b64c76b-jdz4l   0/1     Terminating   0              3h8m
observer-549b64c76b-jg5gj   0/1     Terminating   0              3h8m
observer-549b64c76b-jggtq   0/1     Terminating   0              3h8m
observer-549b64c76b-jhnr6   1/1     Terminating   0              3h8m
observer-549b64c76b-jjjbr   0/1     Terminating   0              3h8m
observer-549b64c76b-jxslx   0/1     Terminating   0              3h8m
observer-549b64c76b-k4fww   0/1     Terminating   0              3h8m
observer-549b64c76b-k9szt   0/1     Terminating   0              3h8m
observer-549b64c76b-kb2rc   0/1     Terminating   0              3h8m
observer-549b64c76b-kdxpf   0/1     Terminating   0              3h8m
observer-549b64c76b-kfmj7   0/1     Terminating   0              3h8m
observer-549b64c76b-kg5bs   0/1     Terminating   0              3h8m
observer-549b64c76b-kgtbc   0/1     Terminating   0              3h8m
observer-549b64c76b-kh25z   0/1     Terminating   0              3h8m
observer-549b64c76b-kpp75   1/1     Terminating   0              3h8m
observer-549b64c76b-kqgxr   0/1     Terminating   0              3h8m
observer-549b64c76b-ks28n   0/1     Terminating   0              3h8m
observer-549b64c76b-ktczp   1/1     Running       1 (170m ago)   3h8m
observer-549b64c76b-kxmj4   0/1     Terminating   0              3h8m
observer-549b64c76b-l4mjf   0/1     Terminating   0              3h8m
observer-549b64c76b-l9qz7   0/1     Terminating   0              3h8m
observer-549b64c76b-ljwrp   0/1     Terminating   0              3h8m
observer-549b64c76b-lpqlj   0/1     Terminating   0              3h8m
observer-549b64c76b-lvwm8   0/1     Terminating   0              3h8m
observer-549b64c76b-lw8lz   1/1     Running       1 (170m ago)   3h8m
observer-549b64c76b-lzgqm   0/1     Terminating   0              3h8m
observer-549b64c76b-m5rww   0/1     Terminating   0              3h8m
observer-549b64c76b-m9s6g   0/1     Terminating   0              3h8m
observer-549b64c76b-mfb2z   0/1     Terminating   0              3h8m
observer-549b64c76b-mfq7g   0/1     Terminating   0              3h8m
observer-549b64c76b-mggtp   0/1     Terminating   0              3h8m
observer-549b64c76b-mtc9b   0/1     Terminating   0              3h8m
observer-549b64c76b-mzbrt   1/1     Terminating   0              3h8m
observer-549b64c76b-n4mjg   1/1     Terminating   0              3h8m
observer-549b64c76b-n9srr   0/1     Terminating   0              3h8m
observer-549b64c76b-nbdr8   0/1     Terminating   0              3h8m
observer-549b64c76b-ndtdg   0/1     Terminating   0              3h8m
observer-549b64c76b-ng4r7   0/1     Terminating   0              3h8m
observer-549b64c76b-njtgj   0/1     Terminating   0              3h8m
observer-549b64c76b-nr9bk   0/1     Terminating   0              3h8m
observer-549b64c76b-nwzmh   0/1     Terminating   0              3h8m
observer-549b64c76b-p2zvt   0/1     Terminating   0              3h8m
observer-549b64c76b-p5sn6   0/1     Terminating   0              3h8m
observer-549b64c76b-p6rxl   0/1     Terminating   0              3h8m
observer-549b64c76b-p6w5b   1/1     Terminating   0              3h8m
observer-549b64c76b-pjbqk   0/1     Terminating   0              3h8m
observer-549b64c76b-pm9gp   0/1     Terminating   0              3h8m
observer-549b64c76b-pmd2w   0/1     Terminating   0              3h8m
observer-549b64c76b-pnwgh   0/1     Terminating   0              3h8m
observer-549b64c76b-prln9   0/1     Terminating   0              3h8m
observer-549b64c76b-ptjhr   0/1     Terminating   0              3h8m
observer-549b64c76b-q27zh   0/1     Terminating   0              3h8m
observer-549b64c76b-q2q9z   0/1     Terminating   0              3h8m
observer-549b64c76b-q5rpb   0/1     Terminating   0              3h8m
observer-549b64c76b-q6262   0/1     Terminating   0              3h8m
observer-549b64c76b-q8vsp   0/1     Terminating   0              3h8m
observer-549b64c76b-q9s8s   0/1     Terminating   0              3h8m
observer-549b64c76b-qlvvj   0/1     Terminating   0              3h8m
observer-549b64c76b-qqnwm   0/1     Terminating   0              3h8m
observer-549b64c76b-qw9ws   0/1     Terminating   0              3h8m
observer-549b64c76b-qzz86   0/1     Terminating   0              3h8m
observer-549b64c76b-rcd9k   0/1     Terminating   0              3h8m
observer-549b64c76b-rf5kf   0/1     Terminating   0              3h8m
observer-549b64c76b-rj4n4   0/1     Terminating   0              3h8m
observer-549b64c76b-s26xn   0/1     Terminating   0              3h8m
observer-549b64c76b-s2ct7   0/1     Terminating   0              3h8m
observer-549b64c76b-s58cf   0/1     Terminating   0              3h8m
observer-549b64c76b-s6xhj   0/1     Terminating   0              3h8m
observer-549b64c76b-sc7r8   0/1     Terminating   0              3h8m
observer-549b64c76b-scvf4   0/1     Terminating   0              3h8m
observer-549b64c76b-sfdhx   0/1     Terminating   0              3h8m
observer-549b64c76b-sfswb   0/1     Terminating   0              3h8m
observer-549b64c76b-sgp92   0/1     Terminating   0              3h8m
observer-549b64c76b-sgrvc   0/1     Terminating   0              3h8m
observer-549b64c76b-sjnxl   0/1     Terminating   0              3h8m
observer-549b64c76b-snlrw   0/1     Terminating   0              3h8m
observer-549b64c76b-sqgv6   0/1     Terminating   0              3h8m
observer-549b64c76b-sr5lv   0/1     Terminating   0              3h8m
observer-549b64c76b-t87fb   0/1     Terminating   0              3h8m
observer-549b64c76b-tcps5   0/1     Terminating   0              3h8m
observer-549b64c76b-tcrdt   1/1     Terminating   0              3h8m
observer-549b64c76b-tkf7l   0/1     Terminating   0              3h8m
observer-549b64c76b-tpsq6   0/1     Terminating   0              3h8m
observer-549b64c76b-tqxnz   0/1     Terminating   0              3h8m
observer-549b64c76b-trt2k   0/1     Terminating   0              3h8m
observer-549b64c76b-v2p4d   1/1     Terminating   0              3h28m
observer-549b64c76b-v4bjw   1/1     Running       0              3h8m
observer-549b64c76b-v8zd7   0/1     Terminating   0              3h8m
observer-549b64c76b-vdplg   1/1     Running       0              3h8m
observer-549b64c76b-vjmlj   0/1     Terminating   0              3h8m
observer-549b64c76b-vndh8   0/1     Terminating   0              3h8m
observer-549b64c76b-vqxz8   0/1     Terminating   0              3h8m
observer-549b64c76b-vshmk   0/1     Terminating   0              3h8m
observer-549b64c76b-w6w4d   0/1     Terminating   0              3h8m
observer-549b64c76b-wc98x   0/1     Terminating   0              3h8m
observer-549b64c76b-wfjt2   0/1     Terminating   0              3h8m
observer-549b64c76b-wnm2f   0/1     Terminating   0              3h8m
observer-549b64c76b-wwrst   0/1     Terminating   0              3h8m
observer-549b64c76b-x4m82   0/1     Terminating   0              3h8m
observer-549b64c76b-x5h9q   0/1     Terminating   0              3h8m
observer-549b64c76b-x5nbj   0/1     Terminating   0              3h8m
observer-549b64c76b-x5p89   0/1     Terminating   0              3h8m
observer-549b64c76b-x5qdq   1/1     Terminating   0              3h28m
observer-549b64c76b-x7r7f   0/1     Terminating   0              3h8m
observer-549b64c76b-x8t4p   0/1     Terminating   0              3h8m
observer-549b64c76b-xhqgw   0/1     Terminating   0              3h8m
observer-549b64c76b-xn5mm   0/1     Terminating   0              3h8m
observer-549b64c76b-xtgnx   1/1     Terminating   0              3h8m
observer-549b64c76b-xvdvb   0/1     Terminating   0              3h8m
observer-549b64c76b-xvn9m   0/1     Terminating   0              3h8m
observer-549b64c76b-xxh2m   0/1     Terminating   0              3h8m
observer-549b64c76b-z4w7j   0/1     Terminating   0              3h8m
observer-549b64c76b-z7jcn   0/1     Terminating   0              3h8m
observer-549b64c76b-zcnqw   0/1     Terminating   0              3h8m
observer-549b64c76b-zfngc   0/1     Terminating   0              3h8m
observer-549b64c76b-zp7rn   0/1     Terminating   0              3h8m

@VestigeJ
Copy link

##Environment Details
Validated using VERSION=v1.28.4-rc1+k3s1

Infrastructure

  • Cloud

Node(s) CPU architecture, OS, and version:

Linux 5.14.21-150500.53-default x86_64 GNU/Linux
PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5"

Cluster Configuration:

NAME   STATUS   ROLES                       AGE   VERSION
ip-7   Ready    control-plane,etcd,master   14m   v1.28.4-rc1+k3s1
ip-6   Ready    control-plane,etcd,master   21m   v1.28.4-rc1+k3s1
ip-5   Ready    control-plane,etcd,master   17m   v1.28.4-rc1+k3s1
ip-4   Ready    <none>                      17m   v1.28.4-rc1+k3s1

Config.yaml:

server: https://1.1.4.13:6443
token: YOUR_TOKEN_HERE
profile: cis
selinux: true
kubelet-arg:
  - max-pods=250
kube-controller-manager-arg:
  - node-cidr-mask-size=22

Validation Steps

$ curl https://get.k3s.io --output install-"k3s".sh
$ sudo chmod +x install-"k3s".sh
$ sudo groupadd --system etcd && sudo useradd -s /sbin/nologin --system -g etcd etcd
$ sudo modprobe ip_vs_rr
$ sudo modprobe ip_vs_wrr
$ sudo modprobe ip_vs_sh
$ sudo printf "on_oovm.panic_on_oom=0 \nvm.overcommit_memory=1 \nkernel.panic=10 \nkernel.panic_ps=1 \nkernel.panic_on_oops=1 \n" > ~/90-kubelet.conf
$ sudo cp 90-kubelet.conf /etc/sysctl.d/
$ sudo systemctl restart systemd-sysctl
$ sudo INSTALL_K3S_VERSION=v1.28.4-rc1+k3s1 INSTALL_K3S_EXEC=server ./install-k3s.sh
$ set_kubefig //export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
$ wget https://gist.githubusercontent.com/brandond/595f80751b037e945f15ba64d3c798e9/raw/da5b48646e4560ddc94170704f6bb34663bd6ed8/nginx.yaml
$ wget https://gist.githubusercontent.com/brandond/595f80751b037e945f15ba64d3c798e9/raw/da5b48646e4560ddc94170704f6bb34663bd6ed8/observer.yaml
$ k create -f nginx.yaml -f observer.yaml
$ sudo journalctl -u k3s
$ kg deploy -A //kubectl get deploy -A
$ k scale deploy observer -n test --replicas=200
$ sudo journalctl -u k3s
k scale deploy observer -n test --replicas=3

Results:

behavior for the pods stuck terminating is resolved and the logs are clear for the starting the watch issue

truncated output from rapidly scaling down observer pods from 200 to 3
$ k scale deploy observer -n test --replicas=3

  1/1     Running   0          11m
nginx-pod-96                1/1     Running   0          11m
nginx-pod-97                1/1     Running   0          11m
nginx-pod-98                1/1     Running   0          11m
nginx-pod-99                1/1     Running   0          11m
observer-549b64c76b-84knw   1/1     Running   0          10m
observer-549b64c76b-8svck   1/1     Running   0          10m
observer-549b64c76b-mnq5j   1/1     Running   0          10m

starting watch isn't found

{"level":"info","ts":"2023-11-27T19:02:12.881088Z","caller":"traceutil/trace.go:171","msg":"trace[17442610] linearizableReadLoop","detail":"{readStateIndex:1544; appliedIndex:1545; }","duration":"103.674966ms","start":"2023-11-27T19:02:12.777391Z","end":"2023-11-27T19:02:12.881072Z","steps":["trace[1744261>
{"level":"warn","ts":"2023-11-27T19:02:12.881469Z","caller":"etcdserver/util.go:170","msg":"apply request took too long","took":"104.084684ms","expected-duration":"100ms","prefix":"read-only range ","request":"key:\"/registry/apiextensions.k8s.io/customresourcedefinitions/\" range_end:\"/registry/apiextens>
{"level":"info","ts":"2023-11-27T19:02:12.8815Z","caller":"traceutil/trace.go:171","msg":"trace[549310907] range","detail":"{range_begin:/registry/apiextensions.k8s.io/customresourcedefinitions/; range_end:/registry/apiextensions.k8s.io/customresourcedefinitions0; response_count:23; response_revision:1460;>
{"level":"info","ts":"2023-11-27T19:02:13.156581Z","caller":"traceutil/trace.go:171","msg":"trace[601126807] linearizableReadLoop","detail":"{readStateIndex:1545; appliedIndex:1545; }","duration":"116.903912ms","start":"2023-11-27T19:02:13.039658Z","end":"2023-11-27T19:02:13.156562Z","steps":["trace[601126>
{"level":"warn","ts":"2023-11-27T19:02:13.156929Z","caller":"etcdserver/util.go:170","msg":"apply request took too long","took":"117.103635ms","expected-duration":"100ms","prefix":"read-only range ","request":"key:\"/registry/apiextensions.k8s.io/customresourcedefinitions/etcdsnapshotfiles.k3s.cattle.io\" >
{"level":"info","ts":"2023-11-27T19:02:13.156968Z","caller":"traceutil/trace.go:171","msg":"trace[156677403] range","detail":"{range_begin:/registry/apiextensions.k8s.io/customresourcedefinitions/etcdsnapshotfiles.k3s.cattle.io; range_end:; response_count:1; response_revision:1460; }","duration":"117.33571>

@tibetsam
Copy link
Author

@brandond @VestigeJ Thanks a lot for the effort to fix the bug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants