<p>Sometimes when I run <code>docker ps -a</code>, I see about 5-10 containers in <code>Exited</code> status. For example, after one or two hours I see them.</p>
<p>Why are there such these exited containers and why are they in <code>Exited</code> status?</p>
<pre><code>9f6bd4fa5a05   8522d622299c             &quot;/opt/bin/flanneld -…&quot;   About a minute ago   Exited (1) About a minute ago             k8s_kube-flannel_kube-flannel-ds-x8s8v_kube-system_024c58c6-9cc2-4c2a-b0d3-12a49101a57b_3
7203f2beaaef   8522d622299c             &quot;cp -f /etc/kube-fla…&quot;   2 minutes ago        Exited (0) About a minute ago             k8s_install-cni_kube-flannel-ds-x8s8v_kube-system_024c58c6-9cc2-4c2a-b0d3-12a49101a57b_1
e4ade2e2617c   09708983cc37             &quot;kube-controller-man…&quot;   2 minutes ago        Exited (2) 2 minutes ago                  k8s_kube-controller-manager_kube-controller-manager-localhost_kube-system_00f8734ea34e7389b55cb740d1fcf000_2
1a3762bfa98c   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 2 minutes ago        Exited (0) 2 minutes ago                  k8s_POD_kube-controller-manager-localhost_kube-system_00f8734ea34e7389b55cb740d1fcf000_2
65555c2db5c6   nginx                    &quot;/docker-entrypoint.…&quot;   5 hours ago          Exited (0) 2 minutes ago                  k8s_task-pv-container_task-pv-pod_default_8bfa648a-ddb0-4531-8984-81d4ce8db444_0
a6b99bcc020a   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 5 hours ago          Exited (0) 2 minutes ago                  k8s_POD_task-pv-pod_default_8bfa648a-ddb0-4531-8984-81d4ce8db444_0
b625c68f4fce   296a6d5035e2             &quot;/coredns -conf /etc…&quot;   6 hours ago          Exited (0) 2 minutes ago                  k8s_coredns_coredns-558bd4d5db-c88d8_kube-system_6170d444-f992-4163-aff0-480cd1ed1ce4_1
7897a49ca8c6   296a6d5035e2             &quot;/coredns -conf /etc…&quot;   6 hours ago          Exited (0) 2 minutes ago                  k8s_coredns_coredns-558bd4d5db-z8kfs_kube-system_b34f29d6-bd72-40ba-a4ba-102e71965f98_1
9b7cac87b4bb   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 6 hours ago          Exited (0) 2 minutes ago                  k8s_POD_coredns-558bd4d5db-z8kfs_kube-system_b34f29d6-bd72-40ba-a4ba-102e71965f98_10
02661c9b507e   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 6 hours ago          Exited (0) 2 minutes ago                  k8s_POD_coredns-558bd4d5db-c88d8_kube-system_6170d444-f992-4163-aff0-480cd1ed1ce4_10
0f31cf13fc3a   38ddd85fe90e             &quot;/usr/local/bin/kube…&quot;   6 hours ago          Exited (2) 2 minutes ago                  k8s_kube-proxy_kube-proxy-s9rf6_kube-system_ff2a1ef4-7316-47c4-8584-aac1a1cd63d5_1
91a53859a423   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 6 hours ago          Exited (0) 2 minutes ago                  k8s_POD_kube-proxy-s9rf6_kube-system_ff2a1ef4-7316-47c4-8584-aac1a1cd63d5_1
a4833a1301a4   4d217480042e             &quot;kube-apiserver --ad…&quot;   6 hours ago          Exited (137) 2 minutes ago                k8s_kube-apiserver_kube-apiserver-localhost_kube-system_bbc60c89c6c6215aca670678072d707c_1
e4d76060736a   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 6 hours ago          Exited (0) 2 minutes ago                  k8s_POD_kube-apiserver-localhost_kube-system_bbc60c89c6c6215aca670678072d707c_1
7c7f09ab3633   0369cf4303ff             &quot;etcd --advertise-cl…&quot;   6 hours ago          Exited (0) 2 minutes ago                  k8s_etcd_etcd-localhost_kube-system_146e48c8e9d3b464d1f47c594a8becc8_1
0204740e75b0   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 6 hours ago          Exited (0) 2 minutes ago                  k8s_POD_etcd-localhost_kube-system_146e48c8e9d3b464d1f47c594a8becc8_1
8631dd16c767   62ad3129eca8             &quot;kube-scheduler --au…&quot;   6 hours ago          Exited (2) 2 minutes ago                  k8s_kube-scheduler_kube-scheduler-localhost_kube-system_7d7118d190aeaaf065b4e86b4982f05f_1
a59ee59475cd   k8s.gcr.io/pause:3.4.1   &quot;/pause&quot;                 6 hours ago          Exited (0) 2 minutes ago                  k8s_POD_kube-scheduler-localhost_kube-system_7d7118d190aeaaf065b4e86b4982f05f_1
</code></pre>
<p>The log of one of them:</p>
<pre><code>docker logs k8s_kube-proxy_kube-proxy-s9rf6_kube-system_ff2a1ef4-7316-47c4-8584-aac1a1cd63d5_1
I0622 09:48:20.971080       1 node.go:172] Successfully retrieved node IP: 192.168.43.85
I0622 09:48:20.971170       1 server_others.go:140] Detected node IP 192.168.43.85
W0622 09:48:20.971200       1 server_others.go:592] Unknown proxy mode &quot;&quot;, assuming iptables proxy
I0622 09:48:25.066916       1 server_others.go:206] kube-proxy running in dual-stack mode, IPv4-primary
I0622 09:48:25.067112       1 server_others.go:212] Using iptables Proxier.
I0622 09:48:25.067154       1 server_others.go:219] creating dualStackProxier for iptables.
W0622 09:48:25.067185       1 server_others.go:506] detect-local-mode set to ClusterCIDR, but no IPv6 cluster CIDR defined, , defaulting to no-op detect-local for IPv6
I0622 09:48:25.187175       1 server.go:643] Version: v1.21.0
I0622 09:48:25.407303       1 conntrack.go:100] Set sysctl 'net/netfilter/nf_conntrack_max' to 131072
I0622 09:48:25.407351       1 conntrack.go:52] Setting nf_conntrack_max to 131072
I0622 09:48:25.407727       1 conntrack.go:83] Setting conntrack hashsize to 32768
I0622 09:48:25.477081       1 conntrack.go:100] Set sysctl 'net/netfilter/nf_conntrack_tcp_timeout_established' to 86400
I0622 09:48:25.477170       1 conntrack.go:100] Set sysctl 'net/netfilter/nf_conntrack_tcp_timeout_close_wait' to 3600
I0622 09:48:25.517411       1 config.go:315] Starting service config controller
I0622 09:48:25.517679       1 config.go:224] Starting endpoint slice config controller
I0622 09:48:25.531370       1 shared_informer.go:240] Waiting for caches to sync for service config
I0622 09:48:25.548740       1 shared_informer.go:240] Waiting for caches to sync for endpoint slice config
W0622 09:48:25.665718       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 09:48:25.667197       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
I0622 09:48:25.731527       1 shared_informer.go:247] Caches are synced for service config 
I0622 09:48:25.753275       1 shared_informer.go:247] Caches are synced for endpoint slice config 
W0622 09:54:21.682298       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:01:18.747213       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:10:27.734119       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:18:50.736315       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:28:33.903205       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:36:05.938074       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:43:23.940703       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:49:20.951579       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 10:58:54.953921       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 11:08:28.961630       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 11:14:26.988498       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 11:20:12.010192       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 11:29:09.023270       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:00:28.838837       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:05:46.840726       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:10:50.843578       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:19:07.846779       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:26:46.848443       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:34:57.853658       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:42:00.887206       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:50:03.935106       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 14:57:18.937677       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 15:03:41.955870       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 15:11:26.957845       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
W0622 15:17:51.979285       1 warnings.go:70] discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
</code></pre>
<pre><code>docker logs k8s_kube-flannel_kube-flannel-ds-x8s8v_kube-system_024c58c6-9cc2-4c2a-b0d3-12a49101a57b_3
I0622 15:19:21.070951       1 main.go:520] Determining IP address of default interface
I0622 15:19:21.071786       1 main.go:533] Using interface with name enp0s3 and address 192.168.43.85
I0622 15:19:21.073223       1 main.go:550] Defaulting external address to interface address (192.168.43.85)
W0622 15:19:21.073336       1 client_config.go:608] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
E0622 15:19:31.157536       1 main.go:251] Failed to create SubnetManager: error retrieving pod spec for 'kube-system/kube-flannel-ds-x8s8v': Get &quot;https://10.96.0.1:443/api/v1/namespaces/kube-system/pods/kube-flannel-ds-x8s8v&quot;: net/http: TLS handshake timeout
</code></pre>

Saeed
<p>You are using deprecated API:</p>
<pre><code>discovery.k8s.io/v1beta1 EndpointSlice is deprecated in v1.21+, unavailable in v1.25+; use discovery.k8s.io/v1 EndpointSlice
</code></pre>
<p>Based on <a href="https://kubernetes.io/docs/reference/using-api/deprecation-guide/" rel="nofollow noreferrer">this documentation</a>:</p>
<blockquote>
<h4>EndpointSlice<a href="https://kubernetes.io/docs/reference/using-api/deprecation-guide/#endpointslice-v125" rel="nofollow noreferrer"></a></h4>
<p>The  <strong>discovery.k8s.io/v1beta1</strong>  API version of EndpointSlice will no longer be served in v1.25.</p>
<ul>
<li>Migrate manifests and API clients to use the  <strong>discovery.k8s.io/v1</strong>  API version, available since v1.21.</li>
<li>All existing persisted objects are accessible via the new API</li>
<li>Notable changes in  <strong>discovery.k8s.io/v1</strong>:
-   use per Endpoint  <code>nodeName</code>  field instead of deprecated  <code>topology[&quot;kubernetes.io/hostname&quot;]</code>  field
-   use per Endpoint  <code>zone</code>  field instead of deprecated  <code>topology[&quot;topology.kubernetes.io/zone&quot;]</code>  field
-   <code>topology</code>  is replaced with the  <code>deprecatedTopology</code>  field which is not writable in v1</li>
</ul>
</blockquote>
<p>You need to find all deprecated API and migrate to supported versions.</p>
