{"id":575,"date":"2018-10-17T17:07:54","date_gmt":"2018-10-17T17:07:54","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=575"},"modified":"2018-10-17T17:27:36","modified_gmt":"2018-10-17T17:27:36","slug":"kubernetes-containerd-integration-goes-ga","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/17\/kubernetes-containerd-integration-goes-ga\/","title":{"rendered":"Kubernetes Containerd Integration Goes GA"},"content":{"rendered":"<h3><a href=\"https:\/\/kubernetes.io\/blog\/2018\/05\/24\/kubernetes-containerd-integration-goes-ga\/\">Kubernetes Containerd Integration Goes GA<\/a><\/h3>\n<p>Authors: Lantao Liu, Software Engineer, Google and Mike Brown, Open Source Developer Advocate, IBM<\/p>\n<p>In a previous blog &#8211; <a href=\"https:\/\/kubernetes.io\/blog\/2017\/11\/containerd-container-runtime-options-kubernetes\" target=\"_blank\" rel=\"noopener\">Containerd Brings More Container Runtime Options for Kubernetes<\/a>, we introduced the alpha version of the Kubernetes containerd integration. With another 6 months of development, the integration with containerd is now generally available! You can now use <a href=\"https:\/\/github.com\/containerd\/containerd\/releases\/tag\/v1.1.0\" target=\"_blank\" rel=\"noopener\">containerd 1.1<\/a> as the container runtime for production Kubernetes clusters!<\/p>\n<p>Containerd 1.1 works with Kubernetes 1.10 and above, and supports all Kubernetes features. The test coverage of containerd integration on <a href=\"https:\/\/cloud.google.com\/\" target=\"_blank\" rel=\"noopener\">Google Cloud Platform<\/a> in Kubernetes test infrastructure is now equivalent to the Docker integration (See: <a href=\"https:\/\/k8s-testgrid.appspot.com\/sig-node-containerd\" target=\"_blank\" rel=\"noopener\">test dashboard)<\/a>.<\/p>\n<p><em>We\u2019re very glad to see containerd rapidly grow to this big milestone. Alibaba Cloud started to use containerd actively since its first day, and thanks to the simplicity and robustness emphasise, make it a perfect container engine running in our Serverless Kubernetes product, which has high qualification on performance and stability. No doubt, containerd will be a core engine of container era, and continue to driving innovation forward.<\/em><\/p>\n<p><em>\u2014 Xinwei, Staff Engineer in Alibaba Cloud<\/em><\/p>\n<p>The Kubernetes containerd integration architecture has evolved twice. Each evolution has made the stack more stable and efficient.<\/p>\n<h2>Containerd 1.0 &#8211; CRI-Containerd (end of life)<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/6b4290afef76cad8a084292cd1b5e468e31c9bb3\/c26ce\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/cri-containerd.png\" alt=\"cri-containerd architecture\" width=\"100%\" \/><\/p>\n<p>For containerd 1.0, a daemon called cri-containerd was required to operate between Kubelet and containerd. Cri-containerd handled the <a href=\"https:\/\/kubernetes.io\/blog\/2016\/12\/container-runtime-interface-cri-in-kubernetes\/\" target=\"_blank\" rel=\"noopener\">Container Runtime Interface (CRI)<\/a> service requests from Kubelet and used containerd to manage containers and container images correspondingly. Compared to the Docker CRI implementation (<a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/tree\/v1.10.2\/pkg\/kubelet\/dockershim\" target=\"_blank\" rel=\"noopener\">dockershim<\/a>), this eliminated one extra hop in the stack.<\/p>\n<p>However, cri-containerd and containerd 1.0 were still 2 different daemons which interacted via grpc. The extra daemon in the loop made it more complex for users to understand and deploy, and introduced unnecessary communication overhead.<\/p>\n<h2>Containerd 1.1 &#8211; CRI Plugin (current)<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/f8dfc688157620f656f96bfd8872deccfbd409e7\/51b10\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/containerd.png\" alt=\"containerd architecture\" width=\"100%\" \/><\/p>\n<p>In containerd 1.1, the cri-containerd daemon is now refactored to be a containerd CRI plugin. The CRI plugin is built into containerd 1.1, and enabled by default. Unlike cri-containerd, the CRI plugin interacts with containerd through direct function calls. This new architecture makes the integration more stable and efficient, and eliminates another grpc hop in the stack. Users can now use Kubernetes with containerd 1.1 directly. The cri-containerd daemon is no longer needed.<\/p>\n<p>Improving performance was one of the major focus items for the containerd 1.1 release. Performance was optimized in terms of pod startup latency and daemon resource usage.<\/p>\n<p>The following results are a comparison between containerd 1.1 and Docker 18.03 CE. The containerd 1.1 integration uses the CRI plugin built into containerd; and the Docker 18.03 CE integration uses the dockershim.<\/p>\n<p>The results were generated using the Kubernetes node performance benchmark, which is part of <a href=\"https:\/\/github.com\/kubernetes\/community\/blob\/master\/contributors\/devel\/e2e-node-tests.md\" target=\"_blank\" rel=\"noopener\">Kubernetes node e2e test<\/a>. Most of the containerd benchmark data is publicly accessible on the <a href=\"http:\/\/node-perf-dash.k8s.io\/\" target=\"_blank\" rel=\"noopener\">node performance dashboard<\/a>.<\/p>\n<h3>Pod Startup Latency<\/h3>\n<p>The \u201c105 pod batch startup benchmark\u201d results show that the containerd 1.1 integration has lower pod startup latency than Docker 18.03 CE integration with dockershim (lower is better).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/d8a8d9e2a79c7bc98f1f8a4c0a16b390d0ffc30b\/00a41\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/latency.png\" alt=\"latency\" \/><\/p>\n<h3>CPU and Memory<\/h3>\n<p>At the steady state, with 105 pods, the containerd 1.1 integration consumes less CPU and memory overall compared to Docker 18.03 CE integration with dockershim. The results vary with the number of pods running on the node, 105 is chosen because it is the current default for the maximum number of user pods per node.<\/p>\n<p>As shown in the figures below, compared to Docker 18.03 CE integration with dockershim, the containerd 1.1 integration has 30.89% lower kubelet cpu usage, 68.13% lower container runtime cpu usage, 11.30% lower kubelet resident set size (RSS) memory usage, 12.78% lower container runtime RSS memory usage.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/22bc8638fa76bb8b2a5c0e1c99cff9c29ec367f7\/5d797\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/cpu.png\" alt=\"cpu\" width=\"50%\" \/><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/8fb3c1516b162bb328664e6bfc6f19f4faa11298\/36013\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/memory.png\" alt=\"memory\" width=\"50%\" \/><\/p>\n<p>Container runtime command-line interface (CLI) is a useful tool for system and application troubleshooting. When using Docker as the container runtime for Kubernetes, system administrators sometimes login to the Kubernetes node to run Docker commands for collecting system and\/or application information. For example, one may use <em>docker ps<\/em> and <em>docker inspect<\/em> to check application process status, <em>docker images<\/em> to list images on the node, and <em>docker info<\/em> to identify container runtime configuration, etc.<\/p>\n<p>For containerd and all other CRI-compatible container runtimes, e.g. dockershim, we recommend using <em>crictl<\/em> as a replacement CLI over the Docker CLI for troubleshooting pods, containers, and container images on Kubernetes nodes.<\/p>\n<p><em>crictl<\/em> is a tool providing a similar experience to the Docker CLI for Kubernetes node troubleshooting and <em>crictl<\/em> works consistently across all CRI-compatible container runtimes. It is hosted in the <a href=\"https:\/\/github.com\/kubernetes-incubator\/cri-tools\" target=\"_blank\" rel=\"noopener\">kubernetes-incubator\/cri-tools<\/a> repository and the current version is <a href=\"https:\/\/github.com\/kubernetes-incubator\/cri-tools\/releases\/tag\/v1.0.0-beta.1\" target=\"_blank\" rel=\"noopener\">v1.0.0-beta.1<\/a>. <em>crictl<\/em> is designed to resemble the Docker CLI to offer a better transition experience for users, but it is not exactly the same. There are a few important differences, explained below.<\/p>\n<p>The scope of <em>crictl<\/em> is limited to troubleshooting, it is not a replacement to docker or kubectl. Docker\u2019s CLI provides a rich set of commands, making it a very useful development tool. But it is not the best fit for troubleshooting on Kubernetes nodes. Some Docker commands are not useful to Kubernetes, such as <em>docker network<\/em> and <em>docker build<\/em>; and some may even break the system, such as <em>docker rename<\/em>. <em>crictl<\/em> provides just enough commands for node troubleshooting, which is arguably safer to use on production nodes.<\/p>\n<h2>Kubernetes Oriented<\/h2>\n<p><em>crictl<\/em> offers a more kubernetes-friendly view of containers. Docker CLI lacks core Kubernetes concepts, e.g. <em>pod<\/em> and <em><a href=\"https:\/\/kubernetes.io\/docs\/concepts\/overview\/working-with-objects\/namespaces\/\" target=\"_blank\" rel=\"noopener\">namespace<\/a><\/em>, so it can\u2019t provide a clear view of containers and pods. One example is that <em>docker ps<\/em> shows somewhat obscure, long Docker container names, and shows pause containers and application containers together:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/994a1ece5991e524ca2386e6edaeb7ff323fa4df\/03781\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/docker-ps.png\" alt=\"docker ps\" width=\"100%\" \/><\/p>\n<p>However, <a href=\"https:\/\/www.ianlewis.org\/en\/almighty-pause-container\" target=\"_blank\" rel=\"noopener\">pause containers<\/a> are a pod implementation detail, where one pause container is used for each pod, and thus should not be shown when listing containers that are members of pods.<\/p>\n<p><em>crictl<\/em>, by contrast, is designed for Kubernetes. It has different sets of commands for pods and containers. For example, <em>crictl pods<\/em> lists pod information, and <em>crictl ps<\/em> only lists application container information. All information is well formatted into table columns.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/2d3c9ed5292021369670c38cd7a64b2f234a9829\/f8927\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/crictl-pods.png\" alt=\"crictl pods\" width=\"100%\" \/><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/4ffce36d5c2c24654b44dbd6df97d29ed40b47c7\/7ed93\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/crictl-ps.png\" alt=\"crictl ps\" width=\"100%\" \/><\/p>\n<p>As another example, <em>crictl pods<\/em> includes a <em>\u2013namespace<\/em> option for filtering pods by the namespaces specified in Kubernetes.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/8138ccc85859c092db7f13b466f5866b3e5b2567\/b1819\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/crictl-pods-filter.png\" alt=\"crictl pods filter\" width=\"100%\" \/><\/p>\n<p>For more details about how to use <em>crictl<\/em> with containerd:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/containerd\/cri\/blob\/master\/docs\/crictl.md\" target=\"_blank\" rel=\"noopener\">Document<\/a><\/li>\n<li><a href=\"https:\/\/asciinema.org\/a\/179047\" target=\"_blank\" rel=\"noopener\">Demo video<\/a><\/li>\n<\/ul>\n<p>\u201cDoes switching to containerd mean I can\u2019t use Docker Engine anymore?\u201d We hear this question a lot, the short answer is NO.<\/p>\n<p>Docker Engine is built on top of containerd. The next release of <a href=\"https:\/\/www.docker.com\/community-edition\" target=\"_blank\" rel=\"noopener\">Docker Community Edition (Docker CE)<\/a> will use containerd version 1.1. Of course, it will have the CRI plugin built-in and enabled by default. This means users will have the option to continue using Docker Engine for other purposes typical for Docker users, while also being able to configure Kubernetes to use the underlying containerd that came with and is simultaneously being used by Docker Engine on the same node. See the architecture figure below showing the same containerd being used by Docker Engine and Kubelet:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/d33wubrfki0l68.cloudfront.net\/cbb16af935843386c15e9a7f2c13fd383fea7599\/9065d\/images\/blog\/2018-05-24-kubernetes-containerd-integration-goes-ga\/docker-ce.png\" alt=\"docker-ce\" width=\"60%\" \/><\/p>\n<p>Since containerd is being used by both Kubelet and Docker Engine, this means users who choose the containerd integration will not just get new Kubernetes features, performance, and stability improvements, they will also have the option of keeping Docker Engine around for other use cases.<\/p>\n<p>A containerd <a href=\"https:\/\/github.com\/containerd\/containerd\/blob\/master\/docs\/namespaces.md\" target=\"_blank\" rel=\"noopener\">namespace<\/a> mechanism is employed to guarantee that Kubelet and Docker Engine won\u2019t see or have access to containers and images created by each other. This makes sure they won\u2019t interfere with each other. This also means that:<\/p>\n<ul>\n<li>Users won\u2019t see Kubernetes created containers with the <em>docker ps<\/em> command. Please use <em>crictl ps<\/em> instead. And vice versa, users won\u2019t see Docker CLI created containers in Kubernetes or with <em>crictl ps<\/em> command. The <em>crictl create<\/em> and <em>crictl runp<\/em> commands are only for troubleshooting. Manually starting pod or container with <em>crictl<\/em> on production nodes is not recommended.<\/li>\n<li>Users won\u2019t see Kubernetes pulled images with the <em>docker images<\/em> command. Please use the <em>crictl images<\/em> command instead. And vice versa, Kubernetes won\u2019t see images created by <em>docker pull<\/em>, <em>docker load<\/em> or <em>docker build<\/em> commands. Please use the <em>crictl pull<\/em> command instead, and <em><a href=\"https:\/\/github.com\/containerd\/containerd\/blob\/master\/docs\/man\/ctr.1.md\" target=\"_blank\" rel=\"noopener\">ctr<\/a> cri load<\/em> if you have to load an image.<\/li>\n<\/ul>\n<ul>\n<li>Containerd 1.1 natively supports CRI. It can be used directly by Kubernetes.<\/li>\n<li>Containerd 1.1 is production ready.<\/li>\n<li>Containerd 1.1 has good performance in terms of pod startup latency and system resource utilization.<\/li>\n<li><em>crictl<\/em> is the CLI tool to talk with containerd 1.1 and other CRI-conformant container runtimes for node troubleshooting.<\/li>\n<li>The next stable release of Docker CE will include containerd 1.1. Users have the option to continue using Docker for use cases not specific to Kubernetes, and configure Kubernetes to use the same underlying containerd that comes with Docker.<\/li>\n<\/ul>\n<p>We\u2019d like to thank all the contributors from Google, IBM, Docker, ZTE, ZJU and many other individuals who made this happen!<\/p>\n<p>For a detailed list of changes in the containerd 1.1 release, please see the release notes here: <a href=\"https:\/\/github.com\/containerd\/containerd\/releases\/tag\/v1.1.0\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/containerd\/containerd\/releases\/tag\/v1.1.0<\/a><\/p>\n<p>To setup a Kubernetes cluster using containerd as the container runtime:<\/p>\n<ul>\n<li>For a production quality cluster on GCE brought up with kube-up.sh, see <a href=\"https:\/\/github.com\/containerd\/cri\/blob\/v1.0.0\/docs\/kube-up.md\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<li>For a multi-node cluster installer and bring up steps using ansible and kubeadm, see <a href=\"https:\/\/github.com\/containerd\/cri\/blob\/v1.0.0\/contrib\/ansible\/README.md\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<li>For creating a cluster from scratch on Google Cloud, see <a href=\"https:\/\/github.com\/kelseyhightower\/kubernetes-the-hard-way\" target=\"_blank\" rel=\"noopener\">Kubernetes the Hard Way<\/a>.<\/li>\n<li>For a custom installation from release tarball, see <a href=\"https:\/\/github.com\/containerd\/cri\/blob\/v1.0.0\/docs\/installation.md\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<li>To install using LinuxKit on a local VM, see <a href=\"https:\/\/github.com\/linuxkit\/linuxkit\/tree\/master\/projects\/kubernetes\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<\/ul>\n<p>The containerd CRI plugin is an open source github project within containerd <a href=\"https:\/\/github.com\/containerd\/cri\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/containerd\/cri<\/a>. Any contributions in terms of ideas, issues, and\/or fixes are welcome. The <a href=\"https:\/\/github.com\/containerd\/cri#getting-started-for-developers\" target=\"_blank\" rel=\"noopener\">getting started guide for developers<\/a> is a good place to start for contributors.<\/p>\n<p>The project is developed and maintained jointly by members of the Kubernetes SIG-Node community and the containerd community. We\u2019d love to hear feedback from you. To join the communities:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/kubernetes\/community\/tree\/master\/sig-node\" target=\"_blank\" rel=\"noopener\">sig-node community site<\/a><\/li>\n<li>Slack:\n<ul>\n<li>#sig-node channel in <a href=\"http:\/\/kubernetes.slack.com\" target=\"_blank\" rel=\"noopener\">kubernetes.slack.com<\/a><\/li>\n<li>#containerd channel in <a href=\"https:\/\/dockr.ly\/community\" target=\"_blank\" rel=\"noopener\">https:\/\/dockr.ly\/community<\/a><\/li>\n<\/ul>\n<\/li>\n<li>Mailing List: <a href=\"https:\/\/groups.google.com\/forum\/#!forum\/kubernetes-sig-node\" target=\"_blank\" rel=\"noopener\">https:\/\/groups.google.com\/forum\/#!forum\/kubernetes-sig-node<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/kubernetes.io\/blog\/2018\/05\/24\/kubernetes-containerd-integration-goes-ga\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes Containerd Integration Goes GA Authors: Lantao Liu, Software Engineer, Google and Mike Brown, Open Source Developer Advocate, IBM In a previous blog &#8211; Containerd Brings More Container Runtime Options for Kubernetes, we introduced the alpha version of the Kubernetes containerd integration. With another 6 months of development, the integration with containerd is now generally &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/17\/kubernetes-containerd-integration-goes-ga\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Kubernetes Containerd Integration Goes GA&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-575","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=575"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/575\/revisions"}],"predecessor-version":[{"id":577,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/575\/revisions\/577"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}