Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and SIGTERM handling.
The termination sequence provides a controlled and graceful process for removing workload replicas from the load balancer pool and handling container termination. This process uses preStop hooks (either default or custom) to manage termination timing and ensure proper connection handling based on your workload’s specific requirements.
The following steps are performed for each workload replica. The shutdown process occurs simultaneously across all containers in a workload, with default configurations giving in-flight requests time to complete and load balancers time to update before containers receive shutdown signals.Termination Grace PeriodBy default, spec.rolloutOptions.terminationGracePeriodSeconds is set to 90 seconds. This controls the total time available for the workload replica to shut down gracefully before all containers receive a SIGKILL signal.
At the start of workload termination, load balancers receive a command to remove the workload replica from the pool. This update process typically takes a few seconds but can take up to 10 seconds. Once updated, new incoming requests are routed to the remaining healthy replicas.
The workload sidecar (managed by Control Plane) and all other workload containers receive commands to begin their termination process. This occurs nearly simultaneously with the load balancer update.
The sidecar continues running normally for 80 seconds by default. This is calculated as 10 seconds less than the termination grace period, which defaults to 90 seconds. The termination grace period can be adjusted in the workload rollout options. As an example, if the termination grace period is reduced to 10 seconds or less, the sidecar hold period would be 0 seconds.
The Control Plane-managed sidecar continues monitoring inbound and outbound network activity from workload containers. The sidecar remains running and waits to drain until no active requests exist. This phase can continue until the termination grace period expires or until no more connections are found.
In the drain phase, the sidecar stops accepting new connections and once again verifies that all existing connections are complete. Once all connections are completed, the sidecar shuts down.
If no custom preStop hook is defined for workload containers, Control Plane applies a default preStop hook that pauses the shutdown process by sleeping.The sleep duration is half of terminationGracePeriodSeconds; with the default 90-second grace period, the process sleeps for 45 seconds.After the sleep completes, the container receives a SIGTERM signal and has the remaining half of the termination grace period to shut down gracefully before receiving a SIGKILL signal.
Consider implementing a custom preStop hook only if your workload requires specific termination logic, such as:
Ensuring connections are gracefully terminated.
Implementing custom request handling during shutdown.
Important: If you implement a custom preStop hook, ensure it includes a delay or checks for ongoing requests before exiting. This allows external load balancers sufficient time to update.After the preStop hook completes, the container receives a SIGTERM signal to terminate gracefully, with the full terminationGracePeriodSeconds (default: 90 seconds) allocated from the start of the shutdown process.
PreStop hook errors: If a custom preStop hook for any container throws an error, then ALL containers will immediately receive a SIGKILL signal.
Implementing a custom preStop hook is only recommended when additional logic is necessary for your specific workload termination requirements. The default preStop hook provides adequate termination handling for most use cases.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Control Plane","description":"Documentation for Control Plane, a hybrid multi-cloud platform for deploying and managing workloads, Kubernetes, networking, secrets, logs, and infrastructure across AWS, GCP, Azure, and private clouds.","colors":{"primary":"#1563ff","light":"#64a5ef","dark":"#1563ff"},"logo":{"light":"https://mintcdn.com/controlplanecorporation/hwvJiAoqIziVJ3gK/logos/dark.svg?fit=max\u0026auto=format\u0026n=hwvJiAoqIziVJ3gK\u0026q=85\u0026s=ec7b5a4bb958adc4d92dedfb41ab2e3c","dark":"https://mintcdn.com/controlplanecorporation/hwvJiAoqIziVJ3gK/logos/light.svg?fit=max\u0026auto=format\u0026n=hwvJiAoqIziVJ3gK\u0026q=85\u0026s=4904ca0b5a8c55fa87495b8edd04aadc"},"favicon":"https://mintcdn.com/controlplanecorporation/hwvJiAoqIziVJ3gK/logos/favicon.png?fit=max\u0026auto=format\u0026n=hwvJiAoqIziVJ3gK\u0026q=85\u0026s=11640a5f7b1a462c233be7a72afa72d7","api":{"openapi":["https://api.cpln.io/openapi.json","https://audit.cpln.io/openapi.json"],"mdx":{"auth":{"method":"bearer"},"server":"https://api.cpln.io"}},"navbar":{"links":[{"href":"https://console.cpln.io/signin","label":"Sign in"}],"primary":{"type":"button","label":"Sign up","href":"https://console.cpln.io/signup"}},"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/control-plane-corporation","youtube":"https://www.youtube.com/@controlplanecorporation","reddit":"https://www.reddit.com/r/controlplane"}},"search":{"prompt":"Search Control Plane docs..."},"seo":{"indexing":"navigable"},"contextual":{"options":["copy","view","chatgpt","claude","perplexity",{"title":"Install MCP Server","description":"Connect the Control Plane MCP Server to your AI tool","icon":"plug","href":"https://docs.controlplane.com/ai/overview"}],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"compass","href":"https://controlplane.com"},{"anchor":"Status","icon":"signal","href":"https://status.cpln.io/"},{"anchor":"Blog","icon":"newspaper","href":"https://controlplane.com/blog"},{"anchor":"FAQ","icon":"question","href":"https://controlplane.com/faq"},{"anchor":"Product Demos","icon":"video","href":"https://controlplane.com/product-demos"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"controlplanecorporation","hasAudioNarration":false,"actualSubdomain":"controlplanecorporation","customDomains":["docs.controlplane.com"],"gitSource":{"type":"github","owner":"controlplane-docs","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ad8e2277d72e48f7068e862","collectionId":"f83e6cad-57dd-4495-ba37-376dd38bd069","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ad8e2277d72e48f7068e862"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"DISABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"DISABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ad8e2277d72e48f7068e862","clientVersion":"0.0.3971","searchFilterCounts":[{"language":"default","tag":"API Reference","count":173},{"language":"default","tag":"Core API","count":164},{"language":"default","tag":"Template Catalog","count":100},{"language":"default","tag":"Templates","count":90},{"language":"default","tag":"Home","count":79},{"language":"default","tag":"How-to Guides","count":71},{"language":"default","tag":"CLI Reference","count":66},{"language":"default","tag":"Reference","count":49},{"language":"default","tag":"Commands","count":38},{"language":"default","tag":"Workload","count":24}],"searchSettings":{"maxResults":5}},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[{"filePath":"global.css","content":"html{overflow-y:scroll}"},{"filePath":"style.css","content":"img[src*=\"/icons/mcp-sidebar.svg\"]{filter:brightness(0) saturate(100%) invert(69%) sepia(9%) saturate(309%) hue-rotate(176deg) brightness(95%) contrast(87%)!important}a[aria-current=page] img[src*=\"/icons/mcp-sidebar.svg\"],img[src*=\"/icons/mcp.svg\"]{filter:brightness(0) saturate(100%) invert(28%) sepia(98%) saturate(3000%) hue-rotate(213deg) brightness(102%) contrast(101%)!important}.dark img[src*=\"/icons/mcp-sidebar.svg\"]{filter:brightness(0) saturate(100%) invert(47%) sepia(8%) saturate(420%) hue-rotate(177deg) brightness(94%) contrast(85%)!important}img.sidebar-group-icon[src*=\"/icons/mcp-sidebar.svg\"]{filter:brightness(0)!important}.dark img.sidebar-group-icon[src*=\"/icons/mcp-sidebar.svg\"]{filter:brightness(0) invert(1)!important}.dark a[aria-current=page] img[src*=\"/icons/mcp-sidebar.svg\"],.dark img[src*=\"/icons/mcp.svg\"]{filter:brightness(0) saturate(100%) invert(63%) sepia(74%) saturate(380%) hue-rotate(186deg) brightness(98%) contrast(91%)!important}.dark img[src*=\"/icons/chatgpt.svg\"],.dark img[src*=\"/icons/codex.svg\"],.dark img[src*=\"/icons/cursor.svg\"],.dark img[src*=\"/icons/opencode.svg\"]{filter:invert(1)!important}"}],"page":{"pagePath":"reference/workload/termination","slug":"/reference/workload/termination","pageMetadata":{"title":"Termination Sequence","description":"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and `SIGTERM` handling.","keywords":["shutdown","pod lifecycle","graceful shutdown","connection drain","rolling update","in-flight requests","sigkill","sigterm","lameduck","deregister","preStop hook"],"href":"/reference/workload/termination"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and \", _jsx(_components.code, {\n children: \"SIGTERM\"\n }), \" handling.\"]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Warning}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`The termination sequence provides a controlled and graceful process for removing workload replicas from the load balancer pool and handling container termination. This process uses preStop hooks (either default or custom) to manage termination timing and ensure proper connection handling based on your workload’s specific requirements.`}),`\n`,_jsx(Heading,{level:`2`,id:`when-termination-occurs`,children:`When Termination Occurs`}),`\n`,_jsx(_components.p,{children:`Workload termination typically happens in these scenarios:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Scaling down`}),`: When reducing the number of workload replicas.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Version updates`}),`: When replacing an old version with a new version after a successful deployment.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Capacity AI`}),`: Regular rollouts similar to version updates when `,_jsx(_components.a,{href:`/reference/workload/capacity`,children:`Capacity AI`}),` is enabled.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Maintenance`}),`: Rare cases where maintenance activities require workload replicas to be rescheduled.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`termination-process-overview`,children:`Termination Process Overview`}),`\n`,_jsx(_components.p,{children:`The following steps are performed for each workload replica. The shutdown process occurs simultaneously across all containers in a workload, with default configurations giving in-flight requests time to complete and load balancers time to update before containers receive shutdown signals.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Termination Grace Period`})}),`\n`,_jsxs(_components.p,{children:[`By default, `,_jsx(_components.code,{children:`spec.rolloutOptions.terminationGracePeriodSeconds`}),` is set to `,_jsx(_components.code,{children:`90`}),` seconds. This controls the total time available for the workload replica to shut down gracefully before all containers receive a `,_jsx(_components.code,{children:`SIGKILL`}),` signal.`]}),`\n`,_jsx(Heading,{level:`3`,id:`1-load-balancer-update`,children:`1. Load Balancer Update`}),`\n`,_jsx(_components.p,{children:`At the start of workload termination, load balancers receive a command to remove the workload replica from the pool. This update process typically takes a few seconds but can take up to 10 seconds. Once updated, new incoming requests are routed to the remaining healthy replicas.`}),`\n`,_jsx(Heading,{level:`3`,id:`2-workload-sidecar-and-container-termination`,children:`2. Workload Sidecar and Container Termination`}),`\n`,_jsx(_components.p,{children:`The workload sidecar (managed by Control Plane) and all other workload containers receive commands to begin their termination process. This occurs nearly simultaneously with the load balancer update.`}),`\n`,_jsx(Heading,{level:`2`,id:`sidecar-termination-process`,children:`Sidecar Termination Process`}),`\n`,_jsxs(_components.p,{children:[`The Control Plane-managed sidecar shutdown process consists of three sequential phases: `,_jsx(_components.strong,{children:`Hold`}),` → `,_jsx(_components.strong,{children:`Monitoring`}),` → `,_jsx(_components.strong,{children:`Drain`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`phase-1-sidecar-hold`,children:`Phase 1: Sidecar Hold`}),`\n`,_jsx(_components.p,{children:`The sidecar continues running normally for 80 seconds by default. This is calculated as 10 seconds less than the termination grace period, which defaults to 90 seconds. The termination grace period can be adjusted in the workload rollout options. As an example, if the termination grace period is reduced to 10 seconds or less, the sidecar hold period would be 0 seconds.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-2-sidecar-monitoring`,children:`Phase 2: Sidecar Monitoring`}),`\n`,_jsx(_components.p,{children:`The Control Plane-managed sidecar continues monitoring inbound and outbound network activity from workload containers. The sidecar remains running and waits to drain until no active requests exist. This phase can continue until the termination grace period expires or until no more connections are found.`}),`\n`,_jsx(Heading,{level:`3`,id:`phase-3-sidecar-drain`,children:`Phase 3: Sidecar Drain`}),`\n`,_jsx(_components.p,{children:`In the drain phase, the sidecar stops accepting new connections and once again verifies that all existing connections are complete. Once all connections are completed, the sidecar shuts down.`}),`\n`,_jsx(Heading,{level:`2`,id:`workload-container-termination-process`,children:`Workload Container Termination Process`}),`\n`,_jsx(Heading,{level:`3`,id:`default-prestop-hook`,children:`Default PreStop Hook`}),`\n`,_jsx(_components.p,{children:`If no custom preStop hook is defined for workload containers, Control Plane applies a default preStop hook that pauses the shutdown process by sleeping.`}),`\n`,_jsxs(_components.p,{children:[`The sleep duration is half of `,_jsx(_components.code,{children:`terminationGracePeriodSeconds`}),`; with the default 90-second grace period, the process sleeps for 45 seconds.`]}),`\n`,_jsxs(_components.p,{children:[`After the sleep completes, the container receives a `,_jsx(_components.code,{children:`SIGTERM`}),` signal and has the remaining half of the termination grace period to shut down gracefully before receiving a `,_jsx(_components.code,{children:`SIGKILL`}),` signal.`]}),`\n`,_jsx(Heading,{level:`3`,id:`custom-prestop-hook-optional`,children:`Custom PreStop Hook (Optional)`}),`\n`,_jsx(_components.p,{children:`Consider implementing a custom preStop hook only if your workload requires specific termination logic, such as:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Ensuring connections are gracefully terminated.`}),`\n`,_jsx(_components.li,{children:`Implementing custom request handling during shutdown.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Important`}),`: If you implement a custom preStop hook, ensure it includes a delay or checks for ongoing requests before exiting. This allows external load balancers sufficient time to update.`]}),`\n`,_jsxs(_components.p,{children:[`After the preStop hook completes, the container receives a `,_jsx(_components.code,{children:`SIGTERM`}),` signal to terminate gracefully, with the full `,_jsx(_components.code,{children:`terminationGracePeriodSeconds`}),` (default: 90 seconds) allocated from the start of the shutdown process.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`PreStop hook errors`}),`: If a custom preStop hook for any container throws an error, then ALL containers will immediately receive a `,_jsx(_components.code,{children:`SIGKILL`}),` signal.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`summary`,children:`Summary`}),`\n`,_jsx(_components.p,{children:`Implementing a custom preStop hook is only recommended when additional logic is necessary for your specific workload termination requirements. The default preStop hook provides adequate termination handling for most use cases.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Termination Sequence","description":"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and `SIGTERM` handling.","keywords":["shutdown","pod lifecycle","graceful shutdown","connection drain","rolling update","in-flight requests","sigkill","sigterm","lameduck","deregister","preStop hook"],"href":"/reference/workload/termination"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"When Termination Occurs","slug":"when-termination-occurs","depth":2,"children":[]},{"title":"Termination Process Overview","slug":"termination-process-overview","depth":2,"children":[{"title":"1. Load Balancer Update","slug":"1-load-balancer-update","depth":3,"children":[]},{"title":"2. Workload Sidecar and Container Termination","slug":"2-workload-sidecar-and-container-termination","depth":3,"children":[]}]},{"title":"Sidecar Termination Process","slug":"sidecar-termination-process","depth":2,"children":[{"title":"Phase 1: Sidecar Hold","slug":"phase-1-sidecar-hold","depth":3,"children":[]},{"title":"Phase 2: Sidecar Monitoring","slug":"phase-2-sidecar-monitoring","depth":3,"children":[]},{"title":"Phase 3: Sidecar Drain","slug":"phase-3-sidecar-drain","depth":3,"children":[]}]},{"title":"Workload Container Termination Process","slug":"workload-container-termination-process","depth":2,"children":[{"title":"Default PreStop Hook","slug":"default-prestop-hook","depth":3,"children":[]},{"title":"Custom PreStop Hook (Optional)","slug":"custom-prestop-hook-optional","depth":3,"children":[]}]},{"title":"Summary","slug":"summary","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/controlplanecorporation/20452e834d3719a6/content/legacy-cli-hash-redirects.js","/_mintlify/custom/controlplanecorporation/dd1961f62f732454/content/sync-tabs.js"],"subdomain":"controlplanecorporation","siteName":"Control Plane","title":"Termination Sequence - Control Plane","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-06T15:56:02.406Z","originalFileLocation":"reference/workload/termination.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and SIGTERM handling.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Control Plane\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Termination Sequence - Control Plane\">\u003cmeta data-mint-head property=\"og:description\" content=\"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and SIGTERM handling.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Control Plane\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.controlplane.com/reference/workload/termination\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://controlplanecorporation.mintlify.app/_mintlify/api/og/v2?division=Workload\u0026amp;title=Termination+Sequence\u0026amp;description=Understand+the+graceful+termination+process+for+workload+replicas%2C+including+preStop+hooks%2C+connection+draining%2C+and+%60SIGTERM%60+handling.\u0026amp;theme=5c8c59bec2193070854fc823\u0026amp;signature=7f71b14e8866bff4804a3152d535c0239081c80ef0feeaf01e40618ab4640573\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Termination Sequence - Control Plane\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and SIGTERM handling.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://controlplanecorporation.mintlify.app/_mintlify/api/og/v2?division=Workload\u0026amp;title=Termination+Sequence\u0026amp;description=Understand+the+graceful+termination+process+for+workload+replicas%2C+including+preStop+hooks%2C+connection+draining%2C+and+%60SIGTERM%60+handling.\u0026amp;theme=5c8c59bec2193070854fc823\u0026amp;signature=7f71b14e8866bff4804a3152d535c0239081c80ef0feeaf01e40618ab4640573\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/controlplanecorporation/N_jUg8p-q778yjKC/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Control Plane\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#1563ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.controlplane.com/reference/workload/termination\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/reference/workload/termination.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.controlplane.com/#organization\",\"name\":\"Control Plane\",\"url\":\"https://docs.controlplane.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/controlplanecorporation/hwvJiAoqIziVJ3gK/logos/dark.svg?fit=max\u0026auto=format\u0026n=hwvJiAoqIziVJ3gK\u0026q=85\u0026s=ec7b5a4bb958adc4d92dedfb41ab2e3c\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.controlplane.com#website\",\"name\":\"Control Plane\",\"url\":\"https://docs.controlplane.com\",\"publisher\":{\"@id\":\"https://docs.controlplane.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.controlplane.com/reference/workload/termination#webpage\",\"url\":\"https://docs.controlplane.com/reference/workload/termination\",\"name\":\"Termination Sequence\",\"description\":\"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and SIGTERM handling.\",\"dateModified\":\"2026-07-06T15:56:02.406Z\",\"isPartOf\":{\"@id\":\"https://docs.controlplane.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.controlplane.com/reference/workload/termination#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.controlplane.com/reference/workload/termination#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reference\",\"item\":\"https://docs.controlplane.com/reference/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Workload\",\"item\":\"https://docs.controlplane.com/reference/workload/general\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Termination Sequence\",\"item\":\"https://docs.controlplane.com/reference/workload/termination\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.controlplane.com/reference/workload/termination#article\",\"headline\":\"Termination Sequence\",\"name\":\"Termination Sequence\",\"description\":\"Understand the graceful termination process for workload replicas, including preStop hooks, connection draining, and SIGTERM handling.\",\"url\":\"https://docs.controlplane.com/reference/workload/termination\",\"mainEntityOfPage\":{\"@id\":\"https://docs.controlplane.com/reference/workload/termination#webpage\"},\"dateModified\":\"2026-07-06T15:56:02.406Z\",\"keywords\":\"shutdown, pod lifecycle, graceful shutdown, connection drain, rolling update, in-flight requests, sigkill, sigterm, lameduck, deregister, preStop hook\",\"publisher\":{\"@id\":\"https://docs.controlplane.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.controlplane.com#website\"}}]}\u003c/script>","siteName":"Control Plane","nav":{"global":{"anchors":[{"anchor":"Website","icon":"compass","href":"https://controlplane.com"},{"anchor":"Status","icon":"signal","href":"https://status.cpln.io/"},{"anchor":"Blog","icon":"newspaper","href":"https://controlplane.com/blog"},{"anchor":"FAQ","icon":"question","href":"https://controlplane.com/faq"},{"anchor":"Product Demos","icon":"video","href":"https://controlplane.com/product-demos"}]},"tabs":[{"tab":"Home","groups":[{"group":"Getting Started","icon":"circle-play","pages":[{"title":"Introduction","href":"/introduction"},{"title":"What is Control Plane?","href":"/whatis"},{"title":"Release Notes","href":"/releases"},{"title":"Compliance","href":"/compliance"}]},{"group":"Quickstart","icon":"rocket","pages":[{"title":"Quickstart","sidebarTitle":"Overview","href":"/quickstart/overview"},{"title":"1. Deploy your first workload","href":"/quickstart/deploy-workload"},{"title":"2. Deploy your own application","href":"/quickstart/deploy-application"},{"title":"3. Service-to-service communication","sidebarTitle":"3. Connect two workloads","href":"/quickstart/connect-workloads"},{"title":"4. Add a database and wire its secret","sidebarTitle":"4. Add a database and secret","href":"/quickstart/database-and-secrets"},{"title":"5. Observe your workload","href":"/quickstart/observe-workload"},{"title":"6. Configure a custom domain","sidebarTitle":"6. Custom domain","tag":"Optional","href":"/quickstart/custom-domain"}]},{"group":"Concepts","icon":"lightbulb","pages":[{"title":"Access Control","href":"/concepts/access-control"},{"title":"Billing Account","href":"/concepts/billing"},{"title":"Command","href":"/concepts/command"},{"title":"Deployment","href":"/concepts/deployment"},{"title":"GVC (Global Virtual Cloud)","href":"/concepts/gvc"},{"title":"Identity","href":"/concepts/identity"},{"title":"Location","href":"/concepts/location"},{"title":"Org (Organization)","href":"/concepts/org"},{"title":"Quota","href":"/concepts/quota"},{"title":"Replica","href":"/concepts/replica"},{"title":"Resource Model","href":"/concepts/resource-model"},{"title":"Workload","href":"/concepts/workload"}]},{"group":"Core","icon":"toolbox","pages":[{"title":"Audit Trail","href":"/core/audittrail"},{"title":"Authentication","href":"/core/authentication"},{"title":"Kubernetes Operator","href":"/core/kubernetes-operator"},{"title":"Logs","href":"/core/logs"},{"title":"Misc","href":"/core/misc"},{"title":"Query","href":"/core/query"},{"title":"Security","href":"/core/security"}]},{"group":"Reference","icon":"book-open","pages":[{"title":"Overview","href":"/reference/overview"},{"title":"Agent","href":"/reference/agent"},{"title":"Audit Context","href":"/reference/auditctx"},{"title":"Billing API","href":"/reference/billing-api"},{"title":"Certificate Generator","href":"/reference/certificategenerator"},{"title":"Cloud Account","href":"/reference/cloudaccount"},{"title":"Deployment","href":"/reference/deployment"},{"title":"Domain","href":"/reference/domain"},{"title":"Error Messages","href":"/reference/error-messages"},{"title":"Event Log","href":"/reference/events"},{"title":"Group","href":"/reference/group"},{"title":"GVC (Global Virtual Cloud)","href":"/reference/gvc"},{"title":"Identity","href":"/reference/identity"},{"title":"Image","href":"/reference/image"},{"title":"IP Set","href":"/reference/ipset"},{"title":"Location","href":"/reference/location"},{"group":"Org","pages":[{"title":"Org (Organization)","sidebarTitle":"Overview","href":"/reference/org"},{"group":"External Logging","pages":[{"title":"Overview","href":"/external-logging/overview"},{"title":"Amazon S3","href":"/external-logging/s3"},{"title":"CloudWatch","href":"/external-logging/cloudwatch"},{"title":"Coralogix","href":"/external-logging/coralogix"},{"title":"Datadog","href":"/external-logging/datadog"},{"title":"Elastic","href":"/external-logging/elastic"},{"title":"Fluentd","href":"/external-logging/fluentd"},{"title":"Logz.io","href":"/external-logging/logz-io"},{"title":"Loki","href":"/external-logging/loki"},{"title":"Stackdriver","href":"/external-logging/stackdriver"},{"title":"Syslog","href":"/external-logging/syslog"},{"title":"OpenTelemetry","href":"/external-logging/opentelemetry"}]}]},{"title":"Policy","href":"/reference/policy"},{"title":"Quota","href":"/reference/quota"},{"title":"Secret","href":"/reference/secret"},{"title":"Service Account","href":"/reference/serviceaccount"},{"title":"Usage API","href":"/reference/usage-api"},{"title":"User","href":"/reference/user"},{"title":"Volume Set","href":"/reference/volumeset"},{"group":"Workload","pages":[{"title":"General","href":"/reference/workload/general"},{"title":"Autoscaling","href":"/reference/workload/autoscaling"},{"title":"Capacity AI","href":"/reference/workload/capacity"},{"title":"Containers","href":"/reference/workload/containers"},{"title":"Custom Metrics","href":"/reference/workload/custom-metrics"},{"title":"Firewall","href":"/reference/workload/firewall"},{"title":"JWT Authentication","href":"/reference/workload/jwt-auth"},{"title":"Load Balancing","href":"/reference/workload/load-balancing"},{"title":"Security","description":"Workload security permissions, access control policies, and configuration options for managing workload resources and operations.","href":"/reference/workload/security"},{"title":"Termination Sequence","href":"/reference/workload/termination"},{"title":"Types","description":"Comparison of workload types: Standard (long-running), Stateful (persistent storage), Cron (scheduled jobs), Serverless (scale-to-zero), and VM (virtual machines). Capabilities matrix.","href":"/reference/workload/types"},{"title":"Virtual Machines","href":"/reference/workload/vm"},{"title":"Volumes","href":"/reference/workload/volumes"}]}]}]},{"tab":"How-to Guides","pages":[{"title":"How-to Guides","href":"/guides/overview"}]},{"tab":"Template Catalog","pages":[{"title":"Template Catalog","href":"/template-catalog/overview"}]},{"tab":"Managed Kubernetes","pages":[{"title":"Managed Kubernetes","href":"/mk8s/overview"}]},{"tab":"CPLN BYOK","pages":[{"title":"CPLN BYOK","href":"/byok/overview"}]},{"tab":"AI Agents","pages":[{"title":"AI Agents","href":"/ai/overview"}]},{"tab":"Infra as Code","pages":[{"title":"Infra as Code","href":"/iac/overview"}]},{"tab":"CLI Reference","pages":[{"title":"CLI Reference","href":"/cli-reference/overview"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/api"}]}]},"title":"Termination Sequence - Control Plane","buildId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","deploymentId":"dpl_DFJrtvUi8HS5F9nkooKuDJsuD5BM","dynamics":[],"chunks":[]}