{"componentChunkName":"component---src-templates-blog-post-js","path":"/post/securing-kubernetes-secrets-how-to-efficiently-secure-access-to-etcd-and-protect-your-secrets","result":{"data":{"headerImage":{"childImageSharp":{"fluid":{"aspectRatio":3.3992537313432836,"src":"/static/b72d38f0a9a131a445c0798c8f11b233/85c19/blog-post-intro.png","srcSet":"/static/b72d38f0a9a131a445c0798c8f11b233/c95ef/blog-post-intro.png 911w,\n/static/b72d38f0a9a131a445c0798c8f11b233/6d938/blog-post-intro.png 1822w,\n/static/b72d38f0a9a131a445c0798c8f11b233/85c19/blog-post-intro.png 3635w","srcWebp":"/static/b72d38f0a9a131a445c0798c8f11b233/bbedc/blog-post-intro.webp","srcSetWebp":"/static/b72d38f0a9a131a445c0798c8f11b233/8f106/blog-post-intro.webp 911w,\n/static/b72d38f0a9a131a445c0798c8f11b233/4b1a2/blog-post-intro.webp 1822w,\n/static/b72d38f0a9a131a445c0798c8f11b233/bbedc/blog-post-intro.webp 3635w","sizes":"(max-width: 3635px) 100vw, 3635px"}}},"relatedPosts":{"nodes":[{"fields":{"slug":"/blog-aws-kubernetes/"},"frontmatter":{"url":"aws-kubernetes/part-1","title":"The State of Kubernetes in AWS: Persistent Data Storage, Application Engineering and More","description":"When it comes to orchestrating containerized workloads, there are several options in the market, with [Kubernetes](https://kubernetes.io) being the most adopted and sought-after solution.","tags":["AWS","Kubernetes"],"date":"2022-12-20T16:44:23.317Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.5,"src":"/static/eb8228db77951dd583fd607fb3b3d3bd/836e2/kubernetes-and-aws.jpg","srcSet":"/static/eb8228db77951dd583fd607fb3b3d3bd/6e81a/kubernetes-and-aws.jpg 120w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/fbe0e/kubernetes-and-aws.jpg 240w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/836e2/kubernetes-and-aws.jpg 480w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/94285/kubernetes-and-aws.jpg 720w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/b1cc5/kubernetes-and-aws.jpg 960w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/097fa/kubernetes-and-aws.jpg 1920w","srcWebp":"/static/eb8228db77951dd583fd607fb3b3d3bd/35871/kubernetes-and-aws.webp","srcSetWebp":"/static/eb8228db77951dd583fd607fb3b3d3bd/83552/kubernetes-and-aws.webp 120w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/2b5a3/kubernetes-and-aws.webp 240w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/35871/kubernetes-and-aws.webp 480w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/9754a/kubernetes-and-aws.webp 720w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/fcc10/kubernetes-and-aws.webp 960w,\n/static/eb8228db77951dd583fd607fb3b3d3bd/30cf3/kubernetes-and-aws.webp 1920w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/kubernetes-node-management/"},"frontmatter":{"url":"karpenter","title":"Karpenter - A New Way to Manage Kubernetes Node Groups","description":"One of the most common discussions that happen when adopting Kubernetes is around autoscaling. You can autoscale your workloads horizontally or vertically, but the main challenge has always been the nodes.\n","tags":["Kubernetes","AWS"],"date":"2022-01-20T00:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.9047619047619047,"src":"/static/e0d4e328e64d982af16b722b7165263b/b460a/aws-karpenter.png","srcSet":"/static/e0d4e328e64d982af16b722b7165263b/d966b/aws-karpenter.png 120w,\n/static/e0d4e328e64d982af16b722b7165263b/67196/aws-karpenter.png 240w,\n/static/e0d4e328e64d982af16b722b7165263b/b460a/aws-karpenter.png 480w,\n/static/e0d4e328e64d982af16b722b7165263b/9a8d7/aws-karpenter.png 720w,\n/static/e0d4e328e64d982af16b722b7165263b/6e898/aws-karpenter.png 960w,\n/static/e0d4e328e64d982af16b722b7165263b/6050d/aws-karpenter.png 1200w","srcWebp":"/static/e0d4e328e64d982af16b722b7165263b/35871/aws-karpenter.webp","srcSetWebp":"/static/e0d4e328e64d982af16b722b7165263b/83552/aws-karpenter.webp 120w,\n/static/e0d4e328e64d982af16b722b7165263b/2b5a3/aws-karpenter.webp 240w,\n/static/e0d4e328e64d982af16b722b7165263b/35871/aws-karpenter.webp 480w,\n/static/e0d4e328e64d982af16b722b7165263b/9754a/aws-karpenter.webp 720w,\n/static/e0d4e328e64d982af16b722b7165263b/fcc10/aws-karpenter.webp 960w,\n/static/e0d4e328e64d982af16b722b7165263b/9000d/aws-karpenter.webp 1200w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/aws-kubernetes-part-2/"},"frontmatter":{"url":"aws-kubernetes/part-2","title":"The Current State of Kubernetes on AWS: Kubernetes Security, Scalability, Performance Engineering & More, Part 2","description":"In the first part of our two-part post on the current state of Kubernetes in AWS, we discussed how Kubernetes can help you handle stateful workloads with persistent data storage and standardize your application and data engineering approaches.","tags":["AWS","Kubernetes"],"date":"2021-12-09T08:30:41.061Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.5,"src":"/static/dddeb31efb8e1c04a57b32e10aa14653/836e2/kubernetes-security.jpg","srcSet":"/static/dddeb31efb8e1c04a57b32e10aa14653/6e81a/kubernetes-security.jpg 120w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/fbe0e/kubernetes-security.jpg 240w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/836e2/kubernetes-security.jpg 480w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/94285/kubernetes-security.jpg 720w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/b1cc5/kubernetes-security.jpg 960w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/097fa/kubernetes-security.jpg 1920w","srcWebp":"/static/dddeb31efb8e1c04a57b32e10aa14653/35871/kubernetes-security.webp","srcSetWebp":"/static/dddeb31efb8e1c04a57b32e10aa14653/83552/kubernetes-security.webp 120w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/2b5a3/kubernetes-security.webp 240w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/35871/kubernetes-security.webp 480w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/9754a/kubernetes-security.webp 720w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/fcc10/kubernetes-security.webp 960w,\n/static/dddeb31efb8e1c04a57b32e10aa14653/30cf3/kubernetes-security.webp 1920w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/gitops-why-is-it-relevant-now/"},"frontmatter":{"url":"gitops-why-is-it-relevant-now","title":"GitOps - Why is it Relevant Now?","description":"There seems to have been a lot of talk about GitOps just recently. This impression is certainly reinforced by the sessions and booths during KubeCon San Diego late 2019. Regardless of the discipline or services, GitOps was the keyword that was constantly repeated.","tags":["Kubernetes"],"date":"2020-01-21T17:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.3333333333333333,"src":"/static/602b397bd0ef200acbf6007f11c2f3f5/836e2/shutterstock_1019460151-1-.jpg","srcSet":"/static/602b397bd0ef200acbf6007f11c2f3f5/6e81a/shutterstock_1019460151-1-.jpg 120w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/fbe0e/shutterstock_1019460151-1-.jpg 240w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/836e2/shutterstock_1019460151-1-.jpg 480w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/94285/shutterstock_1019460151-1-.jpg 720w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/b1cc5/shutterstock_1019460151-1-.jpg 960w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/405f0/shutterstock_1019460151-1-.jpg 4856w","srcWebp":"/static/602b397bd0ef200acbf6007f11c2f3f5/35871/shutterstock_1019460151-1-.webp","srcSetWebp":"/static/602b397bd0ef200acbf6007f11c2f3f5/83552/shutterstock_1019460151-1-.webp 120w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/2b5a3/shutterstock_1019460151-1-.webp 240w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/35871/shutterstock_1019460151-1-.webp 480w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/9754a/shutterstock_1019460151-1-.webp 720w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/fcc10/shutterstock_1019460151-1-.webp 960w,\n/static/602b397bd0ef200acbf6007f11c2f3f5/cdeed/shutterstock_1019460151-1-.webp 4856w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/setting-up-a-multi-tenant-aws-eks-cluster/"},"frontmatter":{"url":"setting-up-a-multi-tenant-aws-eks-cluster","title":"Setting up a Multi-tenant Amazon EKS cluster: a few things to consider","description":"MyOps prides itself in heavy use of cloud-native technology, and Kubernetes is often the primary platform of choice to run containerized workloads. In this blog we discuss using name space, network policies, Integrating AWS IAM to EKS cluster/workloads, isolation techniques and much more.","tags":["Kubernetes","AWS"],"date":"2019-12-12T17:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.7647058823529411,"src":"/static/242e9209b664bee2a7dc6b090d3a07e1/836e2/setting-up-multi-tenant-aws-eks-cluster.jpg","srcSet":"/static/242e9209b664bee2a7dc6b090d3a07e1/6e81a/setting-up-multi-tenant-aws-eks-cluster.jpg 120w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/fbe0e/setting-up-multi-tenant-aws-eks-cluster.jpg 240w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/836e2/setting-up-multi-tenant-aws-eks-cluster.jpg 480w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/94285/setting-up-multi-tenant-aws-eks-cluster.jpg 720w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/b1cc5/setting-up-multi-tenant-aws-eks-cluster.jpg 960w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/e147c/setting-up-multi-tenant-aws-eks-cluster.jpg 5760w","srcWebp":"/static/242e9209b664bee2a7dc6b090d3a07e1/35871/setting-up-multi-tenant-aws-eks-cluster.webp","srcSetWebp":"/static/242e9209b664bee2a7dc6b090d3a07e1/83552/setting-up-multi-tenant-aws-eks-cluster.webp 120w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/2b5a3/setting-up-multi-tenant-aws-eks-cluster.webp 240w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/35871/setting-up-multi-tenant-aws-eks-cluster.webp 480w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/9754a/setting-up-multi-tenant-aws-eks-cluster.webp 720w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/fcc10/setting-up-multi-tenant-aws-eks-cluster.webp 960w,\n/static/242e9209b664bee2a7dc6b090d3a07e1/b4d70/setting-up-multi-tenant-aws-eks-cluster.webp 5760w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/walkthrough-ecs-local/"},"frontmatter":{"url":"walkthrough-ecs-local","title":"Walkthrough - ECS Local: Bringing ECS to your local environment","description":"As someone who works with AWS on a day-to-day basis, It's important to stay up to date with all the changes and new features of the different services on the platform. That's how one recent announcement caught my eye - The new capability of local testing of ECS.","tags":["Kubernetes","AWS"],"date":"2019-09-17T16:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":2.142857142857143,"src":"/static/12224681f2fd40bf0749423e29cf8d0c/836e2/technology-education-information-handover.jpg","srcSet":"/static/12224681f2fd40bf0749423e29cf8d0c/6e81a/technology-education-information-handover.jpg 120w,\n/static/12224681f2fd40bf0749423e29cf8d0c/fbe0e/technology-education-information-handover.jpg 240w,\n/static/12224681f2fd40bf0749423e29cf8d0c/836e2/technology-education-information-handover.jpg 480w,\n/static/12224681f2fd40bf0749423e29cf8d0c/94285/technology-education-information-handover.jpg 720w,\n/static/12224681f2fd40bf0749423e29cf8d0c/b1cc5/technology-education-information-handover.jpg 960w,\n/static/12224681f2fd40bf0749423e29cf8d0c/0ff54/technology-education-information-handover.jpg 1200w","srcWebp":"/static/12224681f2fd40bf0749423e29cf8d0c/35871/technology-education-information-handover.webp","srcSetWebp":"/static/12224681f2fd40bf0749423e29cf8d0c/83552/technology-education-information-handover.webp 120w,\n/static/12224681f2fd40bf0749423e29cf8d0c/2b5a3/technology-education-information-handover.webp 240w,\n/static/12224681f2fd40bf0749423e29cf8d0c/35871/technology-education-information-handover.webp 480w,\n/static/12224681f2fd40bf0749423e29cf8d0c/9754a/technology-education-information-handover.webp 720w,\n/static/12224681f2fd40bf0749423e29cf8d0c/fcc10/technology-education-information-handover.webp 960w,\n/static/12224681f2fd40bf0749423e29cf8d0c/9000d/technology-education-information-handover.webp 1200w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/opensource-data-lakes-for-the-hybrid-cloud-designing-an-oss-datalake/"},"frontmatter":{"url":"opensource-data-lakes-for-the-hybrid-cloud-designing-an-oss-datalake","title":"OpenSource Data Lake for the Hybrid Cloud - Part 2: Designing an OSS DataLake","description":"In part 1 of this series, we answered the question of WHY Open Source components are often an attractive option when building a data lake of any significant size. In this second installment, we describe HOW to cost-effectively build a data lake out of Open Source components.","tags":["Kubernetes","Big Data"],"date":"2019-08-27T16:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.6,"src":"/static/107087aec2d3327919bcfb2ab38201da/836e2/datalake-p2.jpg","srcSet":"/static/107087aec2d3327919bcfb2ab38201da/6e81a/datalake-p2.jpg 120w,\n/static/107087aec2d3327919bcfb2ab38201da/fbe0e/datalake-p2.jpg 240w,\n/static/107087aec2d3327919bcfb2ab38201da/836e2/datalake-p2.jpg 480w,\n/static/107087aec2d3327919bcfb2ab38201da/94285/datalake-p2.jpg 720w,\n/static/107087aec2d3327919bcfb2ab38201da/b1cc5/datalake-p2.jpg 960w,\n/static/107087aec2d3327919bcfb2ab38201da/32638/datalake-p2.jpg 6399w","srcWebp":"/static/107087aec2d3327919bcfb2ab38201da/35871/datalake-p2.webp","srcSetWebp":"/static/107087aec2d3327919bcfb2ab38201da/83552/datalake-p2.webp 120w,\n/static/107087aec2d3327919bcfb2ab38201da/2b5a3/datalake-p2.webp 240w,\n/static/107087aec2d3327919bcfb2ab38201da/35871/datalake-p2.webp 480w,\n/static/107087aec2d3327919bcfb2ab38201da/9754a/datalake-p2.webp 720w,\n/static/107087aec2d3327919bcfb2ab38201da/fcc10/datalake-p2.webp 960w,\n/static/107087aec2d3327919bcfb2ab38201da/85285/datalake-p2.webp 6399w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/opensource-data-lake-for-the-hybrid-cloud/"},"frontmatter":{"url":"opensource-data-lake-for-the-hybrid-cloud","title":"OpenSource Data Lake for the Hybrid Cloud - Part 1","description":"Data lakes have become the de-facto standard for Enterprises and Corporations looking to take advantage of their existing Data.\n","tags":["Kubernetes","Big Data"],"date":"2019-06-17T16:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":1.5,"src":"/static/8640602d41c9ebdbd88a4281c37bcae9/836e2/myops-data-lake-blog-profile-1-.jpg","srcSet":"/static/8640602d41c9ebdbd88a4281c37bcae9/6e81a/myops-data-lake-blog-profile-1-.jpg 120w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/fbe0e/myops-data-lake-blog-profile-1-.jpg 240w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/836e2/myops-data-lake-blog-profile-1-.jpg 480w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/94285/myops-data-lake-blog-profile-1-.jpg 720w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/b1cc5/myops-data-lake-blog-profile-1-.jpg 960w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/724c8/myops-data-lake-blog-profile-1-.jpg 1000w","srcWebp":"/static/8640602d41c9ebdbd88a4281c37bcae9/35871/myops-data-lake-blog-profile-1-.webp","srcSetWebp":"/static/8640602d41c9ebdbd88a4281c37bcae9/83552/myops-data-lake-blog-profile-1-.webp 120w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/2b5a3/myops-data-lake-blog-profile-1-.webp 240w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/35871/myops-data-lake-blog-profile-1-.webp 480w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/9754a/myops-data-lake-blog-profile-1-.webp 720w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/fcc10/myops-data-lake-blog-profile-1-.webp 960w,\n/static/8640602d41c9ebdbd88a4281c37bcae9/36ebb/myops-data-lake-blog-profile-1-.webp 1000w","sizes":"(max-width: 480px) 100vw, 480px"}}}}},{"fields":{"slug":"/securing-kubernetes-secrets-how-to-efficiently-secure-access-to-etcd-and-protect-your-secrets/"},"frontmatter":{"url":"securing-kubernetes-secrets-how-to-efficiently-secure-access-to-etcd-and-protect-your-secrets","title":"Securing Kubernetes secrets: How to efficiently secure access to etcd and protect your secrets","description":"Etcd is a distributed, consistent and highly-available key value store used as the Kubernetes backing store for all cluster data, making it a core component of every K8s deployment. Due to its central role etcd may contain sensitive information related to access of the deployed services and their associated components,","tags":["Kubernetes","Security"],"date":"2018-06-20T16:00:00.000Z","image":{"childImageSharp":{"fluid":{"aspectRatio":0.7407407407407407,"src":"/static/62bd016a89ce5970467a24df70a52cf0/836e2/close-up-door-golden-67537.jpg","srcSet":"/static/62bd016a89ce5970467a24df70a52cf0/6e81a/close-up-door-golden-67537.jpg 120w,\n/static/62bd016a89ce5970467a24df70a52cf0/fbe0e/close-up-door-golden-67537.jpg 240w,\n/static/62bd016a89ce5970467a24df70a52cf0/836e2/close-up-door-golden-67537.jpg 480w,\n/static/62bd016a89ce5970467a24df70a52cf0/94285/close-up-door-golden-67537.jpg 720w,\n/static/62bd016a89ce5970467a24df70a52cf0/b1cc5/close-up-door-golden-67537.jpg 960w,\n/static/62bd016a89ce5970467a24df70a52cf0/fb46d/close-up-door-golden-67537.jpg 2820w","srcWebp":"/static/62bd016a89ce5970467a24df70a52cf0/35871/close-up-door-golden-67537.webp","srcSetWebp":"/static/62bd016a89ce5970467a24df70a52cf0/83552/close-up-door-golden-67537.webp 120w,\n/static/62bd016a89ce5970467a24df70a52cf0/2b5a3/close-up-door-golden-67537.webp 240w,\n/static/62bd016a89ce5970467a24df70a52cf0/35871/close-up-door-golden-67537.webp 480w,\n/static/62bd016a89ce5970467a24df70a52cf0/9754a/close-up-door-golden-67537.webp 720w,\n/static/62bd016a89ce5970467a24df70a52cf0/fcc10/close-up-door-golden-67537.webp 960w,\n/static/62bd016a89ce5970467a24df70a52cf0/d0805/close-up-door-golden-67537.webp 2820w","sizes":"(max-width: 480px) 100vw, 480px"}}}}}]},"socials":{"frontmatter":{"socials":{"linkedin":"https://www.linkedin.com/company/myops-yael","github":"https://github.com/opsguru-israel"}}},"markdownRemark":{"html":"<p>Etcd is a distributed, consistent and highly-available key value store used as the <a href=\"/kubernetes-enablement\">Kubernetes</a> backing store for all cluster data, making it a core component of every K8s deployment.</p>\n<p>Due to its central role etcd may contain sensitive information related to access of the deployed services and their associated components, such as database credentials, CA keys, LDAP logins credentials it is a premium target for malicious attacks.</p>\n<p>Historically, in traditional, non-containerised environments, this data was NOT stored in such a centralised manner as credentials were usually under an ownership of a specific team that was responsible for maintaining a certain component of the stack: the DB access credentials, for example, were known only to the DBA team, CA keys have been in the hands of few selected System Administrators etc.</p>\n<p>With K8s, the required approach is notably different as credentials are now kept within a single central place (etcd), which, if not properly hardened, can lead to serious security breaches as the attacker may now create fake certificates, access databases and applications.</p>\n<p>Managing and hardening your secrets becomes even more critical with tools such as Helm and Tiller; these tools allow you to install (or redeploy) an entire K8s based datacenter within minutes and they constantly interact with etcd.</p>\n<p>The Center for Internet Security (CIS) came up with this publicly available <a href=\"https://www.cisecurity.org/benchmark/kubernetes/\">document</a> providing guidance on how to properly harden and secure your Kubernetes cluster.</p>\n<p>The only single recommendation CIS provides regarding hardening etcd is using TLS:</p>\n<blockquote>\n<p><em>ETCD is a highly available key-value store used by Kubernetes deployments for persistent storage of all of its REST API objects. Its access should be restricted to specifically designated clients and peers only.\nAuthentication to ETCD is based on whether the certificate presented was issued by a trusted certificate authority. There is no checking of certificate attributes such as common name or subject alternative name. As such, if any attackers were able to gain access to any certificate issued by the trusted certificate authority, they would be able to gain full access to the ETCD database.\nUse a different certificate authority for ETCD from the one used for Kubernetes.</em></p>\n</blockquote>\n<p>However, using TLS on its own is not sufficient as a solution. Every certificate created and signed with the same CA has the potential to access every service inside the cluster. The problem is further exacerbated if a single CA is used for all k8s clusters. Even when each kubernetes cluster has a dedicated CA, new client keys can be easily created but as easily revoked. Once again, any new keys created automatically have access to every service in the targeted k8s cluster.</p>\n<p>Because of the severity of the security risks associated with etcd, we will look into 2 additional methods that can be implemented to further secure your etcd data:<br>\n<br>\nEncrypting secrets (and/or other resources) in etcdUsing certificates to stop clients from accessing the etcd server</p>\n<p>To follow the steps illustrated in the following sections, it is necessary to start up a Kubernetes cluster. This can be done using any of the methods immediately below.</p>\n<p>Vanilla K8s:</p>\n<p><a href=\"https://raw.githubusercontent.com/ops-guru/k8s-securing-etcd/master/install_k8s_1.10.sh\">install</a> script for latest kubernetes 1.10. This is the first version that installs etcd with tls <a href=\"https://raw.githubusercontent.com/ops-guru/k8s-securing-etcd/master/install_k8s_1.9.sh\">install</a> script for older kubernetes versions, when etcd was not installed with tls by default</p>\n<p>This also works on openshift platform. You can see the install script <a href=\"https://github.com/ops-guru/k8s-securing-etcd/blob/master/install_openshift.sh\">here</a>. All relative commands for openshift are in <a href=\"https://github.com/ops-guru/k8s-securing-etcd/blob/master/openshift_cmd.sh\">this</a> script.</p>\n<p>The install scripts have been tested on AWS <a href=\"https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-b81dbfc5\">Centos ami</a>. It should work for you too if you use the same image.</p>\n<h2><a href=\"https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/\">Encrypting Secret Data at Rest</a></h2>\n<p>Starting with K8s 1.7 (and etcd v3) you can encrypt resources inside etcd using several different algorithms. At the very least, you should encrypt all your secrets. It is especially true if you are using Helm as a lot of Helm charts require LDAP or DB credentials to be directly made available in the ConfigMaps.</p>\n<p>The encryption follows a very simple rule:</p>\n<p>encrypt using the first provider defineddecrypt after locating a functional provider at checking each provider in the order the providers are defined</p>\n<p>To implement the full workflow, it is necessary to add the experimental-encryption-provider-config flag to the apiserver</p>\n<p>Define the EncryptionConfig config file (place the content in /etc/kubernetes/pki/encryption-config.yaml)</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"46966890619459670000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`kind: EncryptionConfig\napiVersion: v1\nresources:\n  - resources:\n      - secrets\n    providers:\n      - identity: {}`, `46966890619459670000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-yaml line-numbers\"><code class=\"language-yaml\"><span class=\"token key atrule\">kind</span><span class=\"token punctuation\">:</span> EncryptionConfig\n<span class=\"token key atrule\">apiVersion</span><span class=\"token punctuation\">:</span> v1\n<span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> secrets\n    <span class=\"token key atrule\">providers</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">identity</span><span class=\"token punctuation\">:</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Within the file, the resources.resources field is an array of Kubernetes resource names that should be encrypted. The providers array is an ordered list of the possible encryption providers.</p>\n<p>Enable experimental-encryption-provider-config in the kube-apiserver. Edit /etc/kubernetes/manifests/kube-apiserver.yaml and add:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"69035338255636324000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`spec:\n  containers:\n    - command:\n        - kube-apiserver\n        - --experimental-encryption-provider-config=/etc/kubernetes/pki/encryption-config.yaml`, `69035338255636324000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-yaml line-numbers\"><code class=\"language-yaml\"><span class=\"token key atrule\">spec</span><span class=\"token punctuation\">:</span>\n  <span class=\"token key atrule\">containers</span><span class=\"token punctuation\">:</span>\n    <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">command</span><span class=\"token punctuation\">:</span>\n        <span class=\"token punctuation\">-</span> kube<span class=\"token punctuation\">-</span>apiserver\n        <span class=\"token punctuation\">-</span> <span class=\"token punctuation\">-</span><span class=\"token punctuation\">-</span>experimental<span class=\"token punctuation\">-</span>encryption<span class=\"token punctuation\">-</span>provider<span class=\"token punctuation\">-</span>config=/etc/kubernetes/pki/encryption<span class=\"token punctuation\">-</span>config.yaml</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Restart the apiserver. Because the API server is being run as a static pod, kubelet will restart it when the configuration change is detected. Otherwise, you will need to restart the service yourself.</p>\n<p>We also install the etcd package in order to print the data from inside the etcd server:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\"># yum install etcd -y\nResolving Dependencies\n--> Running transaction check\n---> Package etcd.x86_64 0:3.2.18-1.el7 will be installed\n--> Finished Dependency Resolution\nDependencies Resolved\n==================================================================================================================================================================================================================================\n Package                                        Arch                                             Version                                                   Repository                                                        Size\n==================================================================================================================================================================================================================================\nInstalling:\n etcd                                           x86_64                                           3.2.18-1.el7                                              optymyze_external_rpms                                           9.3 M\nTransaction Summary\n==================================================================================================================================================================================================================================\nInstall  1 Package\nTotal download size: 9.3 M\nInstalled size: 42 M\nDownloading packages:\netcd-3.2.18-1.el7.x86_64.rpm                                                                                                                                                                               | 9.3 MB  00:00:00\nRunning transaction check\nRunning transaction test\nTransaction test succeeded\nRunning transaction\n  Installing : etcd-3.2.18-1.el7.x86_64                                                                                                                                                                                       1/1\nUploading Package Profile\n  Verifying  : etcd-3.2.18-1.el7.x86_64                                                                                                                                                                                       1/1\nInstalled:\n  etcd.x86_64 0:3.2.18-1.el7\nComplete!\nUploading Enabled Repositories Report\nLoaded plugins: fastestmirror, priorities, product-id</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Also, to make the commands shorter, set an alias for etcdctl command with TLS parameters. Here we will use the certificates paths created by kubeadm-1.10. You should update them for your specific cluster if needed (check by runninggrep -- '--etcd' /etc/kubernetes/manifests/kube-apiserver.yaml).</p>\n<p>Meaning of variables:</p>\n<p>DIR — path where the k8s certificates are createdSSL<em>OPS — etcdctl parameters to enable TLS connectivitySECRETS</em>PATH — path in etcd where kubernetes keeps secrets</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\">DIR=/etc/kubernetes/pki/\nSSL_OPTS=\"--cacert=${DIR}/etcd/ca.crt --cert=${DIR}/apiserver-etcd-client.crt --key=${DIR}/apiserver-etcd-client.key --endpoints=localhost:2379\"\nSECRETS_PATH=/registry/secrets</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span></span></pre></div>\n<p>Test that we can list stuff in etcd:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get --keys-only=true --prefix $SECRETS_PATH\n/registry/secrets/default/default-token-rhwwn\n/registry/secrets/kube-public/default-token-9qfc8\n/registry/secrets/kube-system/attachdetach-controller-token-clvsn\n.............</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h2>No Encryption</h2>\n<p>To demonstrate the difference of our solution, we begin with no encryption. This provider doesn't do any encryption. It can be used in case you want to decrypt everything or just to test.</p>\n<p>Let's create a secret and read it directly from etcd. You should be able to clearly see the key name and key value:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\"># kubectl create secret generic secret1  --from-literal=XX_mykey_XX=ZZ_mydata_ZZ\nsecret \"secret1\" created\n# kubectl get secret secret1 -o yaml\napiVersion: v1\ndata:\n  XX_mykey_XX: WlpfbXlkYXRhX1pa\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-06-18T13:11:54Z\n  name: secret1\n  namespace: default\n  resourceVersion: \"20410585\"\n  selfLink: /api/v1/namespaces/default/secrets/secret1\n  uid: 2bb3b7df-72f9-11e8-ad5f-005056b1028d\ntype: Opaque\n# ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret1 -w fields | grep Value\n\"Value\" : \"k8s\\x00\\n\\f\\n\\x02v1\\x12\\x06Secret\\x12s\\nL\\n\\asecret1\\x12\\x00\\x1a\\adefault\\\"\\x00*$2bb3b7df-72f9-11e8-ad5f-005056b1028d2\\x008\\x00B\\b\\b\\x9aߞ\\xd9\\x05\\x10\\x00z\\x00\\x12\\x1b\\n\\vXX_mykey_XX\\x12\\fZZ_mydata_ZZ\\x1a\\x06Opaque\\x1a\\x00\\\"\\x00\"</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h2>Apply an Encryption Algorithm</h2>\n<p>Let's add an encryption algorithm to see what happens. We choose aescbcbecause this is the recommended choice for encryption at rest.</p>\n<p>Update encryption-config.yaml:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"13988887299162544000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`kind: EncryptionConfig\napiVersion: v1\nresources:\n  - resources:\n      - secrets\n    providers:\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - identity: {}`, `13988887299162544000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-yaml line-numbers\"><code class=\"language-yaml\"><span class=\"token key atrule\">kind</span><span class=\"token punctuation\">:</span> EncryptionConfig\n<span class=\"token key atrule\">apiVersion</span><span class=\"token punctuation\">:</span> v1\n<span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> secrets\n    <span class=\"token key atrule\">providers</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">aescbc</span><span class=\"token punctuation\">:</span>\n          <span class=\"token key atrule\">keys</span><span class=\"token punctuation\">:</span>\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key1\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> c2VjcmV0IGlzIHNlY3VyZQ==\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key2\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> dGhpcyBpcyBwYXNzd29yZA==\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">identity</span><span class=\"token punctuation\">:</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Since kubelet only monitors pods defined in /etc/kubernetes/manifests, this change will not be caught, so we need to restart the apiserver manually:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\">docker stop $(docker ps | grep k8s_kube-apiserver | gawk '{print $1}')</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span></span></pre></div>\n<p>Test:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\"># kubectl create secret generic secret2 --from-literal=XX_mykey_XX=ZZ_mydata_ZZ\nsecret \"secret2\" created\n# kubectl get secret secret2 -o yaml\napiVersion: v1\ndata:\n  XX_mykey_XX: WlpfbXlkYXRhX1pa\nkind: Secret\nmetadata:\n  creationTimestamp: 2018-06-18T14:23:06Z\n  name: secret2\n  namespace: default\n  resourceVersion: \"20418382\"\n  selfLink: /api/v1/namespaces/default/secrets/secret2\n  uid: 1e4f5d2f-7303-11e8-8c2c-005056b1028d\ntype: Opaque\n# ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret2 -w fields | grep Value\n\"Value\" : \"k8s:enc:aescbc:v1:key1\".</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>The new secret was encrypted now with \"k8s:enc:aescbc:v1:key1\".</p>\n<p>Let's encrypt all the other secrets as well:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\"># kubectl get secrets --all-namespaces -o json | kubectl replace -f -\nsecret \"default-token-rhwwn\" replaced\nsecret \"secret1\" replaced\nsecret \"secret2\" replaced\nsecret \"default-token-9qfc8\" replaced\nsecret \"attachdetach-controller-token-clvsn\" replaced\nsecret \"bootstrap-signer-token-xgnfg\" replaced\n....</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Check that the old secret is now encrypted:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"2757043600226860500\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret1 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:aescbc:v1:key1:\\xda\\nW0~\\x83\\xe4\\x80Ճ\\$J\\x1e\\xa2\\x02z\\xc9\\v\\xd1\\xd0\\$)\\xb2K\\x9f\\xc2\\xff\\xcdJ5\\xfa\\&quot;\\x13\\xc4\\f\\x86\\xc0{P\\xceW\\x9e\\xd1z;b\\$\\x97\\xe8\\xb4l\\xd0\\xfa\\xd8 \\xe2Vc\\x8c\\xa2\\xcd\\xe5\\xb0\\x04(l\\x18\\x13\\xbf\\xe2\\xb7|\\xf1m\\xef)\\xfd\\x97\\xcbk-\\&quot;\\xba\\x819\\xcf,_\\xf6\\fxP\\xf2\\x13\\x94\\x9b\\xca\\xf4\\xde{d\\xcb\\xceq\\x84q\\xae\\xaa\\x06\\x14\\xb7q\\x1d|L\\x8eS\\x8c\\xc9\\$\\x8e\\x80D\\xf0\\xda\\xe2si\\xb6,@\\xa2\\xf9\\xae\\xf2~\\xe3w\\x8e4fr{e\\x0f'\\xcc\\xf6\\xe7\\xadd\\x83^\\xdb\\x03\\xf1jT\\x13>&quot;`, `2757043600226860500`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret1 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:aescbc:v1:key1:<span class=\"token entity\" title=\"\\xda\">\\xda</span><span class=\"token entity\" title=\"\\n\">\\n</span>W0~<span class=\"token entity\" title=\"\\x83\">\\x83</span><span class=\"token entity\" title=\"\\xe4\">\\xe4</span><span class=\"token entity\" title=\"\\x80\">\\x80</span>Ճ<span class=\"token variable\">$J</span><span class=\"token entity\" title=\"\\x1e\">\\x1e</span><span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\x02\">\\x02</span>z<span class=\"token entity\" title=\"\\xc9\">\\xc9</span><span class=\"token entity\" title=\"\\v\">\\v</span><span class=\"token entity\" title=\"\\xd1\">\\xd1</span><span class=\"token entity\" title=\"\\xd0\">\\xd0</span>$)<span class=\"token entity\" title=\"\\xb2\">\\xb2</span>K<span class=\"token entity\" title=\"\\x9f\">\\x9f</span><span class=\"token entity\" title=\"\\xc2\">\\xc2</span><span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span>J5<span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\&quot;\">\\\"</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xc4\">\\xc4</span><span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\x86\">\\x86</span><span class=\"token entity\" title=\"\\xc0\">\\xc0</span>{P<span class=\"token entity\" title=\"\\xce\">\\xce</span>W<span class=\"token entity\" title=\"\\x9e\">\\x9e</span><span class=\"token entity\" title=\"\\xd1\">\\xd1</span>z;b$<span class=\"token entity\" title=\"\\x97\">\\x97</span><span class=\"token entity\" title=\"\\xe8\">\\xe8</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span>l<span class=\"token entity\" title=\"\\xd0\">\\xd0</span><span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\xd8\">\\xd8</span> <span class=\"token entity\" title=\"\\xe2\">\\xe2</span>Vc<span class=\"token entity\" title=\"\\x8c\">\\x8c</span><span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\x04\">\\x04</span>(l<span class=\"token entity\" title=\"\\x18\">\\x18</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>|<span class=\"token entity\" title=\"\\xf1\">\\xf1</span>m<span class=\"token entity\" title=\"\\xef\">\\xef</span>)<span class=\"token entity\" title=\"\\xfd\">\\xfd</span><span class=\"token entity\" title=\"\\x97\">\\x97</span><span class=\"token entity\" title=\"\\xcb\">\\xcb</span>k-<span class=\"token entity\" title=\"\\&quot;\">\\\"</span><span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x81\">\\x81</span>9<span class=\"token entity\" title=\"\\xcf\">\\xcf</span>,_<span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\f\">\\f</span>xP<span class=\"token entity\" title=\"\\xf2\">\\xf2</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\x9b\">\\x9b</span><span class=\"token entity\" title=\"\\xca\">\\xca</span><span class=\"token entity\" title=\"\\xf4\">\\xf4</span><span class=\"token entity\" title=\"\\xde\">\\xde</span>{d<span class=\"token entity\" title=\"\\xcb\">\\xcb</span><span class=\"token entity\" title=\"\\xce\">\\xce</span>q<span class=\"token entity\" title=\"\\x84\">\\x84</span>q<span class=\"token entity\" title=\"\\xae\">\\xae</span><span class=\"token entity\" title=\"\\xaa\">\\xaa</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>q<span class=\"token entity\" title=\"\\x1d\">\\x1d</span>|L<span class=\"token entity\" title=\"\\x8e\">\\x8e</span>S<span class=\"token entity\" title=\"\\x8c\">\\x8c</span><span class=\"token entity\" title=\"\\xc9\">\\xc9</span>$<span class=\"token entity\" title=\"\\x8e\">\\x8e</span><span class=\"token entity\" title=\"\\x80\">\\x80</span>D<span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\xda\">\\xda</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span>si<span class=\"token entity\" title=\"\\xb6\">\\xb6</span>,@<span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\xf9\">\\xf9</span><span class=\"token entity\" title=\"\\xae\">\\xae</span><span class=\"token entity\" title=\"\\xf2\">\\xf2</span>~<span class=\"token entity\" title=\"\\xe3\">\\xe3</span>w<span class=\"token entity\" title=\"\\x8e\">\\x8e</span>4fr{e<span class=\"token entity\" title=\"\\x0f\">\\x0f</span>'<span class=\"token entity\" title=\"\\xcc\">\\xcc</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\xe7\">\\xe7</span><span class=\"token entity\" title=\"\\xad\">\\xad</span>d<span class=\"token entity\" title=\"\\x83\">\\x83</span>^<span class=\"token entity\" title=\"\\xdb\">\\xdb</span><span class=\"token entity\" title=\"\\x03\">\\x03</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span>jT<span class=\"token entity\" title=\"\\x13\">\\x13</span>>\"</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>Each resource is encrypted with a specific key. If you change the value of that key, kubernetes will not be able to decode it anymore. You can test this by swapping the name of the keys and try to retrieve it:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-text line-numbers\"><code class=\"language-text\"># cat /etc/kubernetes/pki/encryption-config.yaml\nkind: EncryptionConfig\napiVersion: v1\nresources:\n  - resources:\n    - secrets\n    providers:\n    - aescbc:\n        keys:\n        - name: key2\n          secret: c2VjcmV0IGlzIHNlY3VyZQ==\n        - name: key1\n          secret: dGhpcyBpcyBwYXNzd29yZA==\n    - identity: {}\n# docker stop $(docker ps | grep k8s_kube-apiserver | gawk '{print $1}')\n000e03b50c0f\n# kubectl get secret secret2 -o yaml\nError from server (InternalError): Internal error occurred: invalid PKCS7 data (empty or not padded)</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h2>Using multiple algorithms</h2>\n<p>In this example we encrypt a secret with a new algorithm and check that different secrets are encrypted with different providers. After that encrypt everything with the new provider. This will change the encryption algorithm to all previous keys to the new one.</p>\n<p>Change encryption-config.yaml, so that the first provider to be the secretbox provider:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"12288251319150522000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`kind: EncryptionConfig\napiVersion: v1\nresources:\n  - resources:\n      - secrets\n    providers:\n      - secretbox:\n          keys:\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - identity: {}`, `12288251319150522000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-yaml line-numbers\"><code class=\"language-yaml\"><span class=\"token key atrule\">kind</span><span class=\"token punctuation\">:</span> EncryptionConfig\n<span class=\"token key atrule\">apiVersion</span><span class=\"token punctuation\">:</span> v1\n<span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> secrets\n    <span class=\"token key atrule\">providers</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">secretbox</span><span class=\"token punctuation\">:</span>\n          <span class=\"token key atrule\">keys</span><span class=\"token punctuation\">:</span>\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key1\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">aescbc</span><span class=\"token punctuation\">:</span>\n          <span class=\"token key atrule\">keys</span><span class=\"token punctuation\">:</span>\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key1\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> c2VjcmV0IGlzIHNlY3VyZQ==\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key2\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> dGhpcyBpcyBwYXNzd29yZA==\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">identity</span><span class=\"token punctuation\">:</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Restart the apiserver:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"50435335626866840000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# docker stop \\$(docker ps | grep k8s_kube-apiserver | gawk '{print \\$1}')`, `50435335626866840000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># docker stop $(docker ps | grep k8s_kube-apiserver | gawk '{print $1}')</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span></span></pre></div>\n<p>Verify that secrets are encrypted correctly: old secret is using aescbc, new one will use secretbox.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"2309937565939446300\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# kubectl create secret generic secret3 --from-literal=XX_mykey_XX=ZZ_mydata_ZZ\nsecret &quot;secret3&quot; created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret1 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:aescbc:v1:key1:\\xda\\nW0~\\x83\\xe4\\x80Ճ\\$J\\x1e\\xa2\\x02z\\xc9\\v\\xd1\\xd0\\$)\\xb2K\\x9f\\xc2\\xff\\xcdJ5\\xfa\\&quot;\\x13\\xc4\\f\\x86\\xc0{P\\xceW\\x9e\\xd1z;b\\$\\x97\\xe8\\xb4l\\xd0\\xfa\\xd8 \\xe2Vc\\x8c\\xa2\\xcd\\xe5\\xb0\\x04(l\\x18\\x13\\xbf\\xe2\\xb7|\\xf1m\\xef)\\xfd\\x97\\xcbk-\\&quot;\\xba\\x819\\xcf,_\\xf6\\fxP\\xf2\\x13\\x94\\x9b\\xca\\xf4\\xde{d\\xcb\\xceq\\x84q\\xae\\xaa\\x06\\x14\\xb7q\\x1d|L\\x8eS\\x8c\\xc9\\$\\x8e\\x80D\\xf0\\xda\\xe2si\\xb6,@\\xa2\\xf9\\xae\\xf2~\\xe3w\\x8e4fr{e\\x0f'\\xcc\\xf6\\xe7\\xadd\\x83^\\xdb\\x03\\xf1jT\\x13>&quot;\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret3 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:secretbox:v1:key1:\\xba\\xf8,Q@\\xb9\\xb6q3\\$k\\x04\\xeeV\\x99|Z'\\xdeE<\\xa5\\xa9n\\x91u\\xb9]RY\\xccc\\xe3\\x13\\x8b\\u07b4Q\\x91\\x9cR2\\xcc\\xc5\\xd9\\x0e\\x19?\\xca\\x1ch\\xde\\x1d%\\xa3N\\x85H\\xb0\\xf6֢\\xe6\\xab\\x06\\xf6\\x960{\\xdb\\xd8^eQ\\xb3\\x05\\x03\\x06)\\x05JH\\x16\\x18\\fp\\x9eu<t\\xea\\x06\\x12\\xf1۹y\\u007f\\x15\\xe5\\x1d\\xef\\x8a2G\\x85'\\x94\\n\\x1d\\x99\\x85ku3\\xa2~\\x12\\x04\\xe5\\x84~\\xaaG\\xd3n\\x98\\x95\\xa0\\xc8_1B\\xcb\\x0f\\xb7;\\x80\\xe1xR\\x86ĳ\\f\\xef\\xd7SA\\x950MQfz~)\\x13\\xc5\\xf1\\xf8\\x91\\x14\\x9d_\\xba\\x82[=M\\x81O\\x1dFNj\\xc1\\x98\\xe4&quot;`, `2309937565939446300`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># kubectl create secret generic secret3 --from-literal=XX_mykey_XX=ZZ_mydata_ZZ</span>\nsecret <span class=\"token string\">\"secret3\"</span> created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret1 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:aescbc:v1:key1:<span class=\"token entity\" title=\"\\xda\">\\xda</span><span class=\"token entity\" title=\"\\n\">\\n</span>W0~<span class=\"token entity\" title=\"\\x83\">\\x83</span><span class=\"token entity\" title=\"\\xe4\">\\xe4</span><span class=\"token entity\" title=\"\\x80\">\\x80</span>Ճ<span class=\"token variable\">$J</span><span class=\"token entity\" title=\"\\x1e\">\\x1e</span><span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\x02\">\\x02</span>z<span class=\"token entity\" title=\"\\xc9\">\\xc9</span><span class=\"token entity\" title=\"\\v\">\\v</span><span class=\"token entity\" title=\"\\xd1\">\\xd1</span><span class=\"token entity\" title=\"\\xd0\">\\xd0</span>$)<span class=\"token entity\" title=\"\\xb2\">\\xb2</span>K<span class=\"token entity\" title=\"\\x9f\">\\x9f</span><span class=\"token entity\" title=\"\\xc2\">\\xc2</span><span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span>J5<span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\&quot;\">\\\"</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xc4\">\\xc4</span><span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\x86\">\\x86</span><span class=\"token entity\" title=\"\\xc0\">\\xc0</span>{P<span class=\"token entity\" title=\"\\xce\">\\xce</span>W<span class=\"token entity\" title=\"\\x9e\">\\x9e</span><span class=\"token entity\" title=\"\\xd1\">\\xd1</span>z;b$<span class=\"token entity\" title=\"\\x97\">\\x97</span><span class=\"token entity\" title=\"\\xe8\">\\xe8</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span>l<span class=\"token entity\" title=\"\\xd0\">\\xd0</span><span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\xd8\">\\xd8</span> <span class=\"token entity\" title=\"\\xe2\">\\xe2</span>Vc<span class=\"token entity\" title=\"\\x8c\">\\x8c</span><span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\x04\">\\x04</span>(l<span class=\"token entity\" title=\"\\x18\">\\x18</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>|<span class=\"token entity\" title=\"\\xf1\">\\xf1</span>m<span class=\"token entity\" title=\"\\xef\">\\xef</span>)<span class=\"token entity\" title=\"\\xfd\">\\xfd</span><span class=\"token entity\" title=\"\\x97\">\\x97</span><span class=\"token entity\" title=\"\\xcb\">\\xcb</span>k-<span class=\"token entity\" title=\"\\&quot;\">\\\"</span><span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x81\">\\x81</span>9<span class=\"token entity\" title=\"\\xcf\">\\xcf</span>,_<span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\f\">\\f</span>xP<span class=\"token entity\" title=\"\\xf2\">\\xf2</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\x9b\">\\x9b</span><span class=\"token entity\" title=\"\\xca\">\\xca</span><span class=\"token entity\" title=\"\\xf4\">\\xf4</span><span class=\"token entity\" title=\"\\xde\">\\xde</span>{d<span class=\"token entity\" title=\"\\xcb\">\\xcb</span><span class=\"token entity\" title=\"\\xce\">\\xce</span>q<span class=\"token entity\" title=\"\\x84\">\\x84</span>q<span class=\"token entity\" title=\"\\xae\">\\xae</span><span class=\"token entity\" title=\"\\xaa\">\\xaa</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>q<span class=\"token entity\" title=\"\\x1d\">\\x1d</span>|L<span class=\"token entity\" title=\"\\x8e\">\\x8e</span>S<span class=\"token entity\" title=\"\\x8c\">\\x8c</span><span class=\"token entity\" title=\"\\xc9\">\\xc9</span>$<span class=\"token entity\" title=\"\\x8e\">\\x8e</span><span class=\"token entity\" title=\"\\x80\">\\x80</span>D<span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\xda\">\\xda</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span>si<span class=\"token entity\" title=\"\\xb6\">\\xb6</span>,@<span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\xf9\">\\xf9</span><span class=\"token entity\" title=\"\\xae\">\\xae</span><span class=\"token entity\" title=\"\\xf2\">\\xf2</span>~<span class=\"token entity\" title=\"\\xe3\">\\xe3</span>w<span class=\"token entity\" title=\"\\x8e\">\\x8e</span>4fr{e<span class=\"token entity\" title=\"\\x0f\">\\x0f</span>'<span class=\"token entity\" title=\"\\xcc\">\\xcc</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\xe7\">\\xe7</span><span class=\"token entity\" title=\"\\xad\">\\xad</span>d<span class=\"token entity\" title=\"\\x83\">\\x83</span>^<span class=\"token entity\" title=\"\\xdb\">\\xdb</span><span class=\"token entity\" title=\"\\x03\">\\x03</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span>jT<span class=\"token entity\" title=\"\\x13\">\\x13</span>>\"</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret3 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:secretbox:v1:key1:<span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\xf8\">\\xf8</span>,Q@<span class=\"token entity\" title=\"\\xb9\">\\xb9</span><span class=\"token entity\" title=\"\\xb6\">\\xb6</span>q3<span class=\"token variable\">$k</span><span class=\"token entity\" title=\"\\x04\">\\x04</span><span class=\"token entity\" title=\"\\xee\">\\xee</span>V<span class=\"token entity\" title=\"\\x99\">\\x99</span>|Z'<span class=\"token entity\" title=\"\\xde\">\\xde</span>E&lt;<span class=\"token entity\" title=\"\\xa5\">\\xa5</span><span class=\"token entity\" title=\"\\xa9\">\\xa9</span>n<span class=\"token entity\" title=\"\\x91\">\\x91</span>u<span class=\"token entity\" title=\"\\xb9\">\\xb9</span>]RY<span class=\"token entity\" title=\"\\xcc\">\\xcc</span>c<span class=\"token entity\" title=\"\\xe3\">\\xe3</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\x8b\">\\x8b</span><span class=\"token entity\" title=\"\\u07b4\">\\u07b4</span>Q<span class=\"token entity\" title=\"\\x91\">\\x91</span><span class=\"token entity\" title=\"\\x9c\">\\x9c</span>R2<span class=\"token entity\" title=\"\\xcc\">\\xcc</span><span class=\"token entity\" title=\"\\xc5\">\\xc5</span><span class=\"token entity\" title=\"\\xd9\">\\xd9</span><span class=\"token entity\" title=\"\\x0e\">\\x0e</span><span class=\"token entity\" title=\"\\x19\">\\x19</span>?<span class=\"token entity\" title=\"\\xca\">\\xca</span><span class=\"token entity\" title=\"\\x1c\">\\x1c</span>h<span class=\"token entity\" title=\"\\xde\">\\xde</span><span class=\"token entity\" title=\"\\x1d\">\\x1d</span>%<span class=\"token entity\" title=\"\\xa3\">\\xa3</span>N<span class=\"token entity\" title=\"\\x85\">\\x85</span>H<span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span>֢<span class=\"token entity\" title=\"\\xe6\">\\xe6</span><span class=\"token entity\" title=\"\\xab\">\\xab</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\x96\">\\x96</span>0{<span class=\"token entity\" title=\"\\xdb\">\\xdb</span><span class=\"token entity\" title=\"\\xd8\">\\xd8</span>^eQ<span class=\"token entity\" title=\"\\xb3\">\\xb3</span><span class=\"token entity\" title=\"\\x05\">\\x05</span><span class=\"token entity\" title=\"\\x03\">\\x03</span><span class=\"token entity\" title=\"\\x06\">\\x06</span>)<span class=\"token entity\" title=\"\\x05\">\\x05</span>JH<span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\x18\">\\x18</span><span class=\"token entity\" title=\"\\f\">\\f</span>p<span class=\"token entity\" title=\"\\x9e\">\\x9e</span>u&lt;t<span class=\"token entity\" title=\"\\xea\">\\xea</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\x12\">\\x12</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span>۹y<span class=\"token entity\" title=\"\\u007f\">\\u007f</span><span class=\"token entity\" title=\"\\x15\">\\x15</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\x1d\">\\x1d</span><span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\x8a\">\\x8a</span>2G<span class=\"token entity\" title=\"\\x85\">\\x85</span>'<span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\n\">\\n</span><span class=\"token entity\" title=\"\\x1d\">\\x1d</span><span class=\"token entity\" title=\"\\x99\">\\x99</span><span class=\"token entity\" title=\"\\x85\">\\x85</span>ku3<span class=\"token entity\" title=\"\\xa2\">\\xa2</span>~<span class=\"token entity\" title=\"\\x12\">\\x12</span><span class=\"token entity\" title=\"\\x04\">\\x04</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\x84\">\\x84</span>~<span class=\"token entity\" title=\"\\xaa\">\\xaa</span>G<span class=\"token entity\" title=\"\\xd3\">\\xd3</span>n<span class=\"token entity\" title=\"\\x98\">\\x98</span><span class=\"token entity\" title=\"\\x95\">\\x95</span><span class=\"token entity\" title=\"\\xa0\">\\xa0</span><span class=\"token entity\" title=\"\\xc8\">\\xc8</span>_1B<span class=\"token entity\" title=\"\\xcb\">\\xcb</span><span class=\"token entity\" title=\"\\x0f\">\\x0f</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>;<span class=\"token entity\" title=\"\\x80\">\\x80</span><span class=\"token entity\" title=\"\\xe1\">\\xe1</span>xR<span class=\"token entity\" title=\"\\x86\">\\x86</span>ĳ<span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\xd7\">\\xd7</span>SA<span class=\"token entity\" title=\"\\x95\">\\x95</span>0MQfz~)<span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xc5\">\\xc5</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span><span class=\"token entity\" title=\"\\xf8\">\\xf8</span><span class=\"token entity\" title=\"\\x91\">\\x91</span><span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\x9d\">\\x9d</span>_<span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x82\">\\x82</span>[=M<span class=\"token entity\" title=\"\\x81\">\\x81</span>O<span class=\"token entity\" title=\"\\x1d\">\\x1d</span>FNj<span class=\"token entity\" title=\"\\xc1\">\\xc1</span><span class=\"token entity\" title=\"\\x98\">\\x98</span><span class=\"token entity\" title=\"\\xe4\">\\xe4</span>\"</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Migrate all secrets to the new provider:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"54370415945034530000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# kubectl get secrets --all-namespaces -o json | kubectl replace -f -`, `54370415945034530000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># kubectl get secrets --all-namespaces -o json | kubectl replace -f -</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span></span></pre></div>\n<h2>Key rotation</h2>\n<p>Here we use the same provider for encryption, but we add a new key. Everything from this moment will be encrypted with the new key. Old values are encrypted with the previous key. At the end we migrate everything to be encrypted with the new key.</p>\n<p>Add a new key to be the first for the secretbox provider (which is still the first provider)</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"80216172501214700000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`kind: EncryptionConfig\napiVersion: v1\nresources:\n  - resources:\n      - secrets\n    providers:\n      - secretbox:\n          keys:\n            - name: key2\n              secret: sAkccgM28JdPNCX9FfTcloYet1zp4OEAtHyViT038zM=\n            - name: key1\n              secret: YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n      - aescbc:\n          keys:\n            - name: key1\n              secret: c2VjcmV0IGlzIHNlY3VyZQ==\n            - name: key2\n              secret: dGhpcyBpcyBwYXNzd29yZA==\n      - identity: {}`, `80216172501214700000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-yaml line-numbers\"><code class=\"language-yaml\"><span class=\"token key atrule\">kind</span><span class=\"token punctuation\">:</span> EncryptionConfig\n<span class=\"token key atrule\">apiVersion</span><span class=\"token punctuation\">:</span> v1\n<span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">resources</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> secrets\n    <span class=\"token key atrule\">providers</span><span class=\"token punctuation\">:</span>\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">secretbox</span><span class=\"token punctuation\">:</span>\n          <span class=\"token key atrule\">keys</span><span class=\"token punctuation\">:</span>\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key2\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> sAkccgM28JdPNCX9FfTcloYet1zp4OEAtHyViT038zM=\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key1\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY=\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">aescbc</span><span class=\"token punctuation\">:</span>\n          <span class=\"token key atrule\">keys</span><span class=\"token punctuation\">:</span>\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key1\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> c2VjcmV0IGlzIHNlY3VyZQ==\n            <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">name</span><span class=\"token punctuation\">:</span> key2\n              <span class=\"token key atrule\">secret</span><span class=\"token punctuation\">:</span> dGhpcyBpcyBwYXNzd29yZA==\n      <span class=\"token punctuation\">-</span> <span class=\"token key atrule\">identity</span><span class=\"token punctuation\">:</span> <span class=\"token punctuation\">{</span><span class=\"token punctuation\">}</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Restart and verify that the new values are encrypted with the new key:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"61149511992806646000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# docker stop \\$(docker ps | grep k8s_kube-apiserver | gawk '{print \\$1}')\n4bdac1937570\n# kubectl create secret generic secret4 --from-literal=XX_mykey_XX=ZZ_mydata_ZZ\nsecret &quot;secret4&quot; created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret4 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:secretbox:v1:key2:\\x92\\xeeyj\\x96\\xfc쵪-8\\x0e\\xa7\\x9a\\xb0\\x16\\xe2\\xb8J\\f_\\x81\\xec\\xf65\\xa9\\x1a\\xe5\\\\xۛ%Ҝ\\xbb\\ax\\xbf\\x00Kz\\xabaD\\x1c\\x94\\x87\\xaervsP\\xf3q\\xf3\\xaeH\\xb8\\x95-\\xef\\r*[yl\\xf3/\\xc4\\x0f\\x00\\a\\x132\\f\\xe1\\x17\\xbf\\xff\\xb4;<\\xec\\xc2\\x01\\xa8\\xc8f\\xff\\xcd\\xf3ʦ\\x83P\\x01\\xcdu\\x16\\x16\\xfa\\xba\\x8f\\xe6\\xe5\\x05\\x96\\xf7k,\\xaa\\xea\\x0f\\x99\\x8f\\xb3\\xc7\\xe6\\xa4=\\x93\\x8a\\xf3S\\x17\\xc6S\\r\\xee\\xea㟷\\x00\\x945o\\xe8\\x8e:W\\xacot\\xeaj,P\\x14\\xbe\\xd0\\x13\\xf91Y\\xf0\\xf0\\x93fW\\xcczD3\\xb9\\xa0\\xb4\\x9e\\xef\\x1aE\\x16\\xc8j_TX\\xae&quot;`, `61149511992806646000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># docker stop $(docker ps | grep k8s_kube-apiserver | gawk '{print $1}')</span>\n4bdac1937570\n<span class=\"token comment\"># kubectl create secret generic secret4 --from-literal=XX_mykey_XX=ZZ_mydata_ZZ</span>\nsecret <span class=\"token string\">\"secret4\"</span> created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret4 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:secretbox:v1:key2:<span class=\"token entity\" title=\"\\x92\">\\x92</span><span class=\"token entity\" title=\"\\xee\">\\xee</span>yj<span class=\"token entity\" title=\"\\x96\">\\x96</span><span class=\"token entity\" title=\"\\xfc\">\\xfc</span>쵪-8<span class=\"token entity\" title=\"\\x0e\">\\x0e</span><span class=\"token entity\" title=\"\\xa7\">\\xa7</span><span class=\"token entity\" title=\"\\x9a\">\\x9a</span><span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span><span class=\"token entity\" title=\"\\xb8\">\\xb8</span>J<span class=\"token entity\" title=\"\\f\">\\f</span>_<span class=\"token entity\" title=\"\\x81\">\\x81</span><span class=\"token entity\" title=\"\\xec\">\\xec</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span>5<span class=\"token entity\" title=\"\\xa9\">\\xa9</span><span class=\"token entity\" title=\"\\x1a\">\\x1a</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\\\\">\\\\</span>xۛ%Ҝ<span class=\"token entity\" title=\"\\xbb\">\\xbb</span><span class=\"token entity\" title=\"\\a\">\\a</span>x<span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\x00\">\\x00</span>Kz<span class=\"token entity\" title=\"\\xab\">\\xab</span>aD<span class=\"token entity\" title=\"\\x1c\">\\x1c</span><span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\x87\">\\x87</span><span class=\"token entity\" title=\"\\xae\">\\xae</span>rvsP<span class=\"token entity\" title=\"\\xf3\">\\xf3</span>q<span class=\"token entity\" title=\"\\xf3\">\\xf3</span><span class=\"token entity\" title=\"\\xae\">\\xae</span>H<span class=\"token entity\" title=\"\\xb8\">\\xb8</span><span class=\"token entity\" title=\"\\x95\">\\x95</span>-<span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\r\">\\r</span>*[yl<span class=\"token entity\" title=\"\\xf3\">\\xf3</span>/<span class=\"token entity\" title=\"\\xc4\">\\xc4</span><span class=\"token entity\" title=\"\\x0f\">\\x0f</span><span class=\"token entity\" title=\"\\x00\">\\x00</span><span class=\"token entity\" title=\"\\a\">\\a</span><span class=\"token entity\" title=\"\\x13\">\\x13</span>2<span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\xe1\">\\xe1</span><span class=\"token entity\" title=\"\\x17\">\\x17</span><span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span>;&lt;<span class=\"token entity\" title=\"\\xec\">\\xec</span><span class=\"token entity\" title=\"\\xc2\">\\xc2</span><span class=\"token entity\" title=\"\\x01\">\\x01</span><span class=\"token entity\" title=\"\\xa8\">\\xa8</span><span class=\"token entity\" title=\"\\xc8\">\\xc8</span>f<span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span><span class=\"token entity\" title=\"\\xf3\">\\xf3</span>ʦ<span class=\"token entity\" title=\"\\x83\">\\x83</span>P<span class=\"token entity\" title=\"\\x01\">\\x01</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span>u<span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x8f\">\\x8f</span><span class=\"token entity\" title=\"\\xe6\">\\xe6</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\x05\">\\x05</span><span class=\"token entity\" title=\"\\x96\">\\x96</span><span class=\"token entity\" title=\"\\xf7\">\\xf7</span>k,<span class=\"token entity\" title=\"\\xaa\">\\xaa</span><span class=\"token entity\" title=\"\\xea\">\\xea</span><span class=\"token entity\" title=\"\\x0f\">\\x0f</span><span class=\"token entity\" title=\"\\x99\">\\x99</span><span class=\"token entity\" title=\"\\x8f\">\\x8f</span><span class=\"token entity\" title=\"\\xb3\">\\xb3</span><span class=\"token entity\" title=\"\\xc7\">\\xc7</span><span class=\"token entity\" title=\"\\xe6\">\\xe6</span><span class=\"token entity\" title=\"\\xa4\">\\xa4</span>=<span class=\"token entity\" title=\"\\x93\">\\x93</span><span class=\"token entity\" title=\"\\x8a\">\\x8a</span><span class=\"token entity\" title=\"\\xf3\">\\xf3</span>S<span class=\"token entity\" title=\"\\x17\">\\x17</span><span class=\"token entity\" title=\"\\xc6\">\\xc6</span>S<span class=\"token entity\" title=\"\\r\">\\r</span><span class=\"token entity\" title=\"\\xee\">\\xee</span><span class=\"token entity\" title=\"\\xea\">\\xea</span>㟷<span class=\"token entity\" title=\"\\x00\">\\x00</span><span class=\"token entity\" title=\"\\x94\">\\x94</span>5o<span class=\"token entity\" title=\"\\xe8\">\\xe8</span><span class=\"token entity\" title=\"\\x8e\">\\x8e</span>:W<span class=\"token entity\" title=\"\\xac\">\\xac</span>ot<span class=\"token entity\" title=\"\\xea\">\\xea</span>j,P<span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\xbe\">\\xbe</span><span class=\"token entity\" title=\"\\xd0\">\\xd0</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xf9\">\\xf9</span>1Y<span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\x93\">\\x93</span>fW<span class=\"token entity\" title=\"\\xcc\">\\xcc</span>zD3<span class=\"token entity\" title=\"\\xb9\">\\xb9</span><span class=\"token entity\" title=\"\\xa0\">\\xa0</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span><span class=\"token entity\" title=\"\\x9e\">\\x9e</span><span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\x1a\">\\x1a</span>E<span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\xc8\">\\xc8</span>j_TX<span class=\"token entity\" title=\"\\xae\">\\xae</span>\"</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h2>ETCD authorization</h2>\n<p>Etcd can use 2 methods to authorize users:</p>\n<p>With username and passwordWith certificates if started with \"--client-cert-auth=true\". It will use the CN from the certificate as the username.</p>\n<p>Unfortunately there are a couple of issues with this:</p>\n<p><a href=\"https://github.com/coreos/etcd/issues/9816\">https://github.com/coreos/etcd/issues/9816</a>: auth doesn't work at all with the default etcd version. You need to update your etcd to version 3.2.18<a href=\"https://github.com/coreos/etcd/issues/9691\">https://github.com/coreos/etcd/issues/9691</a>: this affects you if you try to create the openshift user inside etcd. But for this one there is also an workaround</p>\n<p>We use cfssl to create the certificates we need to connect to etcd. Lets download the binaries and put them in our path:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"40455260418891870000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# curl -L https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -O && /bin/mv ./cfssl_linux-amd64 /bin/cfssl && chmod +x /bin/cfssl\n# curl -L https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -O && /bin/mv ./cfssljson_linux-amd64 /bin/cfssljson && chmod +x /bin/cfssljson`, `40455260418891870000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># curl -L https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 -O &amp;&amp; /bin/mv ./cfssl_linux-amd64 /bin/cfssl &amp;&amp; chmod +x /bin/cfssl</span>\n<span class=\"token comment\"># curl -L https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64 -O &amp;&amp; /bin/mv ./cfssljson_linux-amd64 /bin/cfssljson &amp;&amp; chmod +x /bin/cfssljson</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>In order to enable etcd ACL, first create the root user:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"58697121467037450000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add root:secretpass\nUser root created`, `58697121467037450000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add root:secretpass</span>\nUser root created</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>Create some roles to test our certificates.</p>\n<p>Users with this role should have read access in the entire cluster:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"89973438881857470000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role add readonly_all\nRole readonly_all created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role grant-permission readonly_all --prefix=true read /\nRole readonly_all updated`, `89973438881857470000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role add readonly_all</span>\nRole readonly_all created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role grant-permission readonly_all --prefix=true read /</span>\nRole readonly_all updated</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Allows users to read and write everywhere:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"38494277867156420000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role add readwrite_all\nRole readwrite_all created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role grant-permission readwrite_all --prefix=true readwrite /\nRole readwrite_all updated`, `38494277867156420000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role add readwrite_all</span>\nRole readwrite_all created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role grant-permission readwrite_all --prefix=true readwrite /</span>\nRole readwrite_all updated</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span></span></pre></div>\n<p>User with this role should only be allowed to access part of etcd tree:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"51298630589043930000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role add readonly_secrets\nRole readonly_secrets created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role grant-permission readonly_secrets --prefix=true read \\$SECRETS_PATH\nRole readonly_secrets updated`, `51298630589043930000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role add readonly_secrets</span>\nRole readonly_secrets created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role grant-permission readonly_secrets --prefix=true read $SECRETS_PATH</span>\nRole readonly_secrets updated</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Role that allows a user to read/write a specific key only:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"16978762051403917000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role add readwrite_secret4\nRole readwrite_secret4 created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS role grant-permission readwrite_secret4 readwrite \\$SECRETS_PATH/default/secret4\nRole readwrite_secret4 updated`, `16978762051403917000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role add readwrite_secret4</span>\nRole readwrite_secret4 created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS role grant-permission readwrite_secret4 readwrite $SECRETS_PATH/default/secret4</span>\nRole readwrite_secret4 updated</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Create users and add assign specific roles to them. Generate random passwords because we don't expect to use them:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"51896741101422950000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add reader:\\$(head -c 32 /dev/urandom | base64)\nUser reader created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add viewsecrets:\\$(head -c 32 /dev/urandom | base64)\nUser viewsecrets created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add admin:\\$(head -c 32 /dev/urandom | base64)\nUser admin created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add usersecret4:\\$(head -c 32 /dev/urandom | base64)\nUser usersecret4 created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user grant-role reader readonly_all\nRole readonly_all is granted to user reader\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user grant-role viewsecrets readonly_secrets\nRole readonly_secrets is granted to user viewsecrets\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user grant-role admin readwrite_all\nRole readwrite_all is granted to user admin\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user grant-role usersecret4 readwrite_secret4\nRole readwrite_secret4 is granted to user usersecret4`, `51896741101422950000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add reader:$(head -c 32 /dev/urandom | base64)</span>\nUser reader created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add viewsecrets:$(head -c 32 /dev/urandom | base64)</span>\nUser viewsecrets created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add admin:$(head -c 32 /dev/urandom | base64)</span>\nUser admin created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add usersecret4:$(head -c 32 /dev/urandom | base64)</span>\nUser usersecret4 created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user grant-role reader readonly_all</span>\nRole readonly_all is granted to user reader\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user grant-role viewsecrets readonly_secrets</span>\nRole readonly_secrets is granted to user viewsecrets\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user grant-role admin readwrite_all</span>\nRole readwrite_all is granted to user admin\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user grant-role usersecret4 readwrite_secret4</span>\nRole readwrite_secret4 is granted to user usersecret4</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Since we are enabling user authorization, we need to have special permissions for the user used by the apiserver to connect to the etcd cluster: we will give it the root role. Kubernetes installation has 2 connections to the etcd server: apiserver and the livenessProbe.</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"34303974755513720000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`openssl x509 -noout -text -in /etc/kubernetes/pki/apiserver-etcd-client.crt | grep &quot;Subject:&quot;\nopenssl x509 -noout -text -in /etc/kubernetes/pki/etcd/healthcheck-client.crt | grep &quot;Subject:&quot;`, `34303974755513720000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\">openssl x509 -noout -text -in /etc/kubernetes/pki/apiserver-etcd-client.crt <span class=\"token operator\">|</span> <span class=\"token function\">grep</span> <span class=\"token string\">\"Subject:\"</span>\nopenssl x509 -noout -text -in /etc/kubernetes/pki/etcd/healthcheck-client.crt <span class=\"token operator\">|</span> <span class=\"token function\">grep</span> <span class=\"token string\">\"Subject:\"</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>Create an user with the name from the CN field of the certificate:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"77946592332047300000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add kube-apiserver-etcd-client:\\$(head -c 32 /dev/urandom | base64)\nUser kube-apiserver-etcd-client created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user add kube-etcd-healthcheck-client:\\$(head -c 32 /dev/urandom | base64)\nUser kube-etcd-healthcheck-client created\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user grant-role kube-apiserver-etcd-client root\nRole root is granted to user kube-apiserver-etcd-client\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS user grant-role kube-etcd-healthcheck-client root\nRole root is granted to user kube-etcd-healthcheck-client`, `77946592332047300000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add kube-apiserver-etcd-client:$(head -c 32 /dev/urandom | base64)</span>\nUser kube-apiserver-etcd-client created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user add kube-etcd-healthcheck-client:$(head -c 32 /dev/urandom | base64)</span>\nUser kube-etcd-healthcheck-client created\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user grant-role kube-apiserver-etcd-client root</span>\nRole root is granted to user kube-apiserver-etcd-client\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS user grant-role kube-etcd-healthcheck-client root</span>\nRole root is granted to user kube-etcd-healthcheck-client</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Enable authentication:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"48532330076712140000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS auth enable\nAuthentication Enabled`, `48532330076712140000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS auth enable</span>\nAuthentication Enabled</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>From this moment, nothing can connect to the etcd cluster without proper certificates. Let's create a certificate with a user that it's not define in etcd and check that it doesn't have access at all:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"45675931095912610000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# function create_certificates {\n  NAME=\\$1\n\n  cat <<EOF | cfssl gencert -config=ca-config.json -profile=client -ca \\$CA_PATH/ca.crt -ca-key \\$CA_PATH/ca.key - | cfssljson -bare \\$NAME\n{&quot;CN&quot;: &quot;\\$NAME&quot;,&quot;key&quot;: {&quot;algo&quot;: &quot;rsa&quot;,&quot;size&quot;: 2048}}\nEOF\nSSL_OPTS=&quot;--cacert=\\$CA_PATH/ca.crt --cert=\\$PWD/\\$NAME.pem --key=\\$PWD/\\$NAME-key.pem --endpoints=\\$HOSTNAME:2379&quot;\n}\n# CA_PATH=/etc/kubernetes/pki/etcd\n# cfssl print-defaults config > ca-config.json\n# create_certificates tester\n2018/06/18 18:52:54 [INFO] generate received request\n2018/06/18 18:52:54 [INFO] received CSR\n2018/06/18 18:52:54 [INFO] generating key: rsa-2048\n2018/06/18 18:52:54 [INFO] encoded CSR\n2018/06/18 18:52:54 [INFO] signed certificate with serial number 722235405009026418318053946143102861163105227800\n2018/06/18 18:52:54 [WARNING] This certificate lacks a &quot;hosts&quot; field. This makes it unsuitable for\nwebsites. For more information see the Baseline Requirements for the Issuance and Management\nof Publicly-Trusted Certificates, v.1.1.6, from the CA/Browser Forum (https://cabforum.org);\nspecifically, section 10.2.3 (&quot;Information Requirements&quot;).\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get / --keys-only --prefix=true\nError:  etcdserver: permission denied`, `45675931095912610000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># function create_certificates {</span>\n  <span class=\"token assign-left variable\">NAME</span><span class=\"token operator\">=</span><span class=\"token variable\">$1</span>\n\n  <span class=\"token function\">cat</span> <span class=\"token operator\">&lt;&lt;</span><span class=\"token string\">EOF<span class=\"token bash punctuation\"> <span class=\"token operator\">|</span> cfssl gencert -config<span class=\"token operator\">=</span>ca-config.json -profile<span class=\"token operator\">=</span>client -ca <span class=\"token variable\">$CA_PATH</span>/ca.crt -ca-key <span class=\"token variable\">$CA_PATH</span>/ca.key - <span class=\"token operator\">|</span> cfssljson -bare <span class=\"token variable\">$NAME</span></span>\n{\"CN\": \"<span class=\"token variable\">$NAME</span>\",\"key\": {\"algo\": \"rsa\",\"size\": 2048}}\nEOF</span>\n<span class=\"token assign-left variable\">SSL_OPTS</span><span class=\"token operator\">=</span><span class=\"token string\">\"--cacert=<span class=\"token variable\">$CA_PATH</span>/ca.crt --cert=<span class=\"token environment constant\">$PWD</span>/<span class=\"token variable\">$NAME</span>.pem --key=<span class=\"token environment constant\">$PWD</span>/<span class=\"token variable\">$NAME</span>-key.pem --endpoints=<span class=\"token environment constant\">$HOSTNAME</span>:2379\"</span>\n<span class=\"token punctuation\">}</span>\n<span class=\"token comment\"># CA_PATH=/etc/kubernetes/pki/etcd</span>\n<span class=\"token comment\"># cfssl print-defaults config > ca-config.json</span>\n<span class=\"token comment\"># create_certificates tester</span>\n<span class=\"token number\">2018</span>/06/18 <span class=\"token number\">18</span>:52:54 <span class=\"token punctuation\">[</span>INFO<span class=\"token punctuation\">]</span> generate received request\n<span class=\"token number\">2018</span>/06/18 <span class=\"token number\">18</span>:52:54 <span class=\"token punctuation\">[</span>INFO<span class=\"token punctuation\">]</span> received CSR\n<span class=\"token number\">2018</span>/06/18 <span class=\"token number\">18</span>:52:54 <span class=\"token punctuation\">[</span>INFO<span class=\"token punctuation\">]</span> generating key: rsa-2048\n<span class=\"token number\">2018</span>/06/18 <span class=\"token number\">18</span>:52:54 <span class=\"token punctuation\">[</span>INFO<span class=\"token punctuation\">]</span> encoded CSR\n<span class=\"token number\">2018</span>/06/18 <span class=\"token number\">18</span>:52:54 <span class=\"token punctuation\">[</span>INFO<span class=\"token punctuation\">]</span> signed certificate with serial number <span class=\"token number\">722235405009026418318053946143102861163105227800</span>\n<span class=\"token number\">2018</span>/06/18 <span class=\"token number\">18</span>:52:54 <span class=\"token punctuation\">[</span>WARNING<span class=\"token punctuation\">]</span> This certificate lacks a <span class=\"token string\">\"hosts\"</span> field. This makes it unsuitable <span class=\"token keyword\">for</span>\nwebsites. For <span class=\"token function\">more</span> information see the Baseline Requirements <span class=\"token keyword\">for</span> the Issuance and Management\nof Publicly-Trusted Certificates, v.1.1.6, from the CA/Browser Forum <span class=\"token punctuation\">(</span>https://cabforum.org<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\nspecifically, section <span class=\"token number\">10.2</span>.3 <span class=\"token punctuation\">(</span><span class=\"token string\">\"Information Requirements\"</span><span class=\"token punctuation\">)</span>.\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get / --keys-only --prefix=true</span>\nError:  etcdserver: permission denied</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Allow an admin user to access the cluster for 2 hours only:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"48233502528866845000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# cfssl print-defaults config | sed s/8760/2/ > ca-config.json\n# create_certificates admin`, `48233502528866845000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># cfssl print-defaults config | sed s/8760/2/ > ca-config.json</span>\n<span class=\"token comment\"># create_certificates admin</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>Admin user can do list:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"66344102018616890000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get / --keys-only --prefix=true\n/registry/apiregistration.k8s.io/apiservices/v1.\n/registry/apiregistration.k8s.io/apiservices/v1.apps\n/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io\n/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io`, `66344102018616890000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get / --keys-only --prefix=true</span>\n/registry/apiregistration.k8s.io/apiservices/v1.\n/registry/apiregistration.k8s.io/apiservices/v1.apps\n/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io\n/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Get a key:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"58566454391165010000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret1 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:aescbc:v1:key1:\\xda\\nW0~\\x83\\xe4\\x80Ճ\\$J\\x1e\\xa2\\x02z\\xc9\\v\\xd1\\xd0\\$)\\xb2K\\x9f\\xc2\\xff\\xcdJ5\\xfa\\&quot;\\x13\\xc4\\f\\x86\\xc0{P\\xceW\\x9e\\xd1z;b\\$\\x97\\xe8\\xb4l\\xd0\\xfa\\xd8 \\xe2Vc\\x8c\\xa2\\xcd\\xe5\\xb0\\x04(l\\x18\\x13\\xbf\\xe2\\xb7|\\xf1m\\xef)\\xfd\\x97\\xcbk-\\&quot;\\xba\\x819\\xcf,_\\xf6\\fxP\\xf2\\x13\\x94\\x9b\\xca\\xf4\\xde{d\\xcb\\xceq\\x84q\\xae\\xaa\\x06\\x14\\xb7q\\x1d|L\\x8eS\\x8c\\xc9\\$\\x8e\\x80D\\xf0\\xda\\xe2si\\xb6,@\\xa2\\xf9\\xae\\xf2~\\xe3w\\x8e4fr{e\\x0f'\\xcc\\xf6\\xe7\\xadd\\x83^\\xdb\\x03\\xf1jT\\x13>&quot;`, `58566454391165010000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret1 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:aescbc:v1:key1:<span class=\"token entity\" title=\"\\xda\">\\xda</span><span class=\"token entity\" title=\"\\n\">\\n</span>W0~<span class=\"token entity\" title=\"\\x83\">\\x83</span><span class=\"token entity\" title=\"\\xe4\">\\xe4</span><span class=\"token entity\" title=\"\\x80\">\\x80</span>Ճ<span class=\"token variable\">$J</span><span class=\"token entity\" title=\"\\x1e\">\\x1e</span><span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\x02\">\\x02</span>z<span class=\"token entity\" title=\"\\xc9\">\\xc9</span><span class=\"token entity\" title=\"\\v\">\\v</span><span class=\"token entity\" title=\"\\xd1\">\\xd1</span><span class=\"token entity\" title=\"\\xd0\">\\xd0</span>$)<span class=\"token entity\" title=\"\\xb2\">\\xb2</span>K<span class=\"token entity\" title=\"\\x9f\">\\x9f</span><span class=\"token entity\" title=\"\\xc2\">\\xc2</span><span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span>J5<span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\&quot;\">\\\"</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xc4\">\\xc4</span><span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\x86\">\\x86</span><span class=\"token entity\" title=\"\\xc0\">\\xc0</span>{P<span class=\"token entity\" title=\"\\xce\">\\xce</span>W<span class=\"token entity\" title=\"\\x9e\">\\x9e</span><span class=\"token entity\" title=\"\\xd1\">\\xd1</span>z;b$<span class=\"token entity\" title=\"\\x97\">\\x97</span><span class=\"token entity\" title=\"\\xe8\">\\xe8</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span>l<span class=\"token entity\" title=\"\\xd0\">\\xd0</span><span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\xd8\">\\xd8</span> <span class=\"token entity\" title=\"\\xe2\">\\xe2</span>Vc<span class=\"token entity\" title=\"\\x8c\">\\x8c</span><span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\x04\">\\x04</span>(l<span class=\"token entity\" title=\"\\x18\">\\x18</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>|<span class=\"token entity\" title=\"\\xf1\">\\xf1</span>m<span class=\"token entity\" title=\"\\xef\">\\xef</span>)<span class=\"token entity\" title=\"\\xfd\">\\xfd</span><span class=\"token entity\" title=\"\\x97\">\\x97</span><span class=\"token entity\" title=\"\\xcb\">\\xcb</span>k-<span class=\"token entity\" title=\"\\&quot;\">\\\"</span><span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x81\">\\x81</span>9<span class=\"token entity\" title=\"\\xcf\">\\xcf</span>,_<span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\f\">\\f</span>xP<span class=\"token entity\" title=\"\\xf2\">\\xf2</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\x9b\">\\x9b</span><span class=\"token entity\" title=\"\\xca\">\\xca</span><span class=\"token entity\" title=\"\\xf4\">\\xf4</span><span class=\"token entity\" title=\"\\xde\">\\xde</span>{d<span class=\"token entity\" title=\"\\xcb\">\\xcb</span><span class=\"token entity\" title=\"\\xce\">\\xce</span>q<span class=\"token entity\" title=\"\\x84\">\\x84</span>q<span class=\"token entity\" title=\"\\xae\">\\xae</span><span class=\"token entity\" title=\"\\xaa\">\\xaa</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>q<span class=\"token entity\" title=\"\\x1d\">\\x1d</span>|L<span class=\"token entity\" title=\"\\x8e\">\\x8e</span>S<span class=\"token entity\" title=\"\\x8c\">\\x8c</span><span class=\"token entity\" title=\"\\xc9\">\\xc9</span>$<span class=\"token entity\" title=\"\\x8e\">\\x8e</span><span class=\"token entity\" title=\"\\x80\">\\x80</span>D<span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\xda\">\\xda</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span>si<span class=\"token entity\" title=\"\\xb6\">\\xb6</span>,@<span class=\"token entity\" title=\"\\xa2\">\\xa2</span><span class=\"token entity\" title=\"\\xf9\">\\xf9</span><span class=\"token entity\" title=\"\\xae\">\\xae</span><span class=\"token entity\" title=\"\\xf2\">\\xf2</span>~<span class=\"token entity\" title=\"\\xe3\">\\xe3</span>w<span class=\"token entity\" title=\"\\x8e\">\\x8e</span>4fr{e<span class=\"token entity\" title=\"\\x0f\">\\x0f</span>'<span class=\"token entity\" title=\"\\xcc\">\\xcc</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\xe7\">\\xe7</span><span class=\"token entity\" title=\"\\xad\">\\xad</span>d<span class=\"token entity\" title=\"\\x83\">\\x83</span>^<span class=\"token entity\" title=\"\\xdb\">\\xdb</span><span class=\"token entity\" title=\"\\x03\">\\x03</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span>jT<span class=\"token entity\" title=\"\\x13\">\\x13</span>>\"</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span></span></pre></div>\n<p>Delete the key:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"68032676822738010000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# ETCDCTL_API=3 etcdctl \\$SSL_OPTS del \\$SECRETS_PATH/default/secret1\n1\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/secret1 -w fields | grep Value`, `68032676822738010000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS del $SECRETS_PATH/default/secret1</span>\n<span class=\"token number\">1</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/secret1 -w fields | grep Value</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span></span></pre></div>\n<p>Increase the date and try to list:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"25049763727196650000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# date \\$(date +%m%d%H%M%Y.%S -d '+1 hour')\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get --keys-only --prefix=true /\n/registry/apiregistration.k8s.io/apiservices/v1.\n/registry/apiregistration.k8s.io/apiservices/v1.apps\n/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io\n/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io\n/registry/apiregistration.k8s.io/apiservices/v1.autoscaling\n/registry/apiregistration.k8s.io/apiservices/v1.batch\n# date \\$(date +%m%d%H%M%Y.%S -d '+1 hour')\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get --keys-only --prefix=true /\nError:  context deadline exceeded\n# date \\$(date +%m%d%H%M%Y.%S -d '-2 hour')`, `25049763727196650000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># date $(date +%m%d%H%M%Y.%S -d '+1 hour')</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get --keys-only --prefix=true /</span>\n/registry/apiregistration.k8s.io/apiservices/v1.\n/registry/apiregistration.k8s.io/apiservices/v1.apps\n/registry/apiregistration.k8s.io/apiservices/v1.authentication.k8s.io\n/registry/apiregistration.k8s.io/apiservices/v1.authorization.k8s.io\n/registry/apiregistration.k8s.io/apiservices/v1.autoscaling\n/registry/apiregistration.k8s.io/apiservices/v1.batch\n<span class=\"token comment\"># date $(date +%m%d%H%M%Y.%S -d '+1 hour')</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get --keys-only --prefix=true /</span>\nError:  context deadline exceeded\n<span class=\"token comment\"># date $(date +%m%d%H%M%Y.%S -d '-2 hour')</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Check that user 'reader' has access everywhere and can't delete anything:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"54565374816405684000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# cfssl print-defaults config > ca-config.json\n# create_certificates reader\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret2 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:aescbc:v1:key1:7^İ\\xe9\\xc8\\x1e\\xa7̔=D+\\x9e%\\x1a\\xf4\\x10o@\\xec\\xc14&<Z\\xd1\\xde\\xfa\\xca-'#\\xa2K\\x1c\\xff\\x101a\\x86\\xb0\\xd7.\\xa9\\x19\\x04\\x93m\\xa1\\xee\\xacDe\\x95/\\xd8\\xe7\\xaehp~\\xc9\\x0e\\xe9\\x8f}\\x9a\\x8a\\xb0f\\xf9\\xeb\\xb7\\u007f@\\x87\\xa0\\xa6\\x98\\xe78\\xd0+\\xd45\\&quot;S\\x17\\x8c\\x84\\xa6ㅽb\\xda\\xe6\\xfc\\xa1\\xd9[[~\\x82\\xfbKS\\x82\\xf0>o\\xc1 \\x8b&{\\xa1\\r\\x14Un\\x03\\xf7\\x1f=\\xe5\\x1b \\xa7t\\xed[\\x8a\\xec\\xb8\\xf1\\xe4\\xe2\\xc1\\x81\\xb00=cbl·ɬ\\x12\\`\\xf2|\\x1b\\t\\xe4#\\xcd&quot;\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS del \\$SECRETS_PATH/default/secret2\nError:  etcdserver: permission denied`, `54565374816405684000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># cfssl print-defaults config > ca-config.json</span>\n<span class=\"token comment\"># create_certificates reader</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret2 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> \"k8s:enc:aescbc:v1:key1:7^İ<span class=\"token punctuation\">\\</span>xe9<span class=\"token punctuation\">\\</span>xc8<span class=\"token punctuation\">\\</span>x1e<span class=\"token punctuation\">\\</span>xa7̔<span class=\"token operator\">=</span>D+<span class=\"token punctuation\">\\</span>x9e%<span class=\"token punctuation\">\\</span>x1a<span class=\"token punctuation\">\\</span>xf4<span class=\"token punctuation\">\\</span>x10o@<span class=\"token punctuation\">\\</span>xec<span class=\"token punctuation\">\\</span>xc14<span class=\"token operator\">&amp;</span><span class=\"token operator\">&lt;</span>Z<span class=\"token punctuation\">\\</span>xd1<span class=\"token punctuation\">\\</span>xde<span class=\"token punctuation\">\\</span>xfa<span class=\"token punctuation\">\\</span>xca-'<span class=\"token comment\">#\\xa2K\\x1c\\xff\\x101a\\x86\\xb0\\xd7.\\xa9\\x19\\x04\\x93m\\xa1\\xee\\xacDe\\x95/\\xd8\\xe7\\xaehp~\\xc9\\x0e\\xe9\\x8f}\\x9a\\x8a\\xb0f\\xf9\\xeb\\xb7\\u007f@\\x87\\xa0\\xa6\\x98\\xe78\\xd0+\\xd45\\\"S\\x17\\x8c\\x84\\xa6ㅽb\\xda\\xe6\\xfc\\xa1\\xd9[[~\\x82\\xfbKS\\x82\\xf0>o\\xc1 \\x8b&amp;{\\xa1\\r\\x14Un\\x03\\xf7\\x1f=\\xe5\\x1b \\xa7t\\xed[\\x8a\\xec\\xb8\\xf1\\xe4\\xe2\\xc1\\x81\\xb00=cbl·ɬ\\x12`\\xf2|\\x1b\\t\\xe4#\\xcd\"</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS del $SECRETS_PATH/default/secret2</span>\nError:  etcdserver: permission denied</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Check that user 'viewsecrets' has access only to read secrets:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"22925233153961400000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# create_certificates viewsecrets\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get --keys-only --prefix=true /\nError:  etcdserver: permission denied\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret3 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:secretbox:v1:key1:\\xba\\xf8,Q@\\xb9\\xb6q3\\$k\\x04\\xeeV\\x99|Z'\\xdeE<\\xa5\\xa9n\\x91u\\xb9]RY\\xccc\\xe3\\x13\\x8b\\u07b4Q\\x91\\x9cR2\\xcc\\xc5\\xd9\\x0e\\x19?\\xca\\x1ch\\xde\\x1d%\\xa3N\\x85H\\xb0\\xf6֢\\xe6\\xab\\x06\\xf6\\x960{\\xdb\\xd8^eQ\\xb3\\x05\\x03\\x06)\\x05JH\\x16\\x18\\fp\\x9eu<t\\xea\\x06\\x12\\xf1۹y\\u007f\\x15\\xe5\\x1d\\xef\\x8a2G\\x85'\\x94\\n\\x1d\\x99\\x85ku3\\xa2~\\x12\\x04\\xe5\\x84~\\xaaG\\xd3n\\x98\\x95\\xa0\\xc8_1B\\xcb\\x0f\\xb7;\\x80\\xe1xR\\x86ĳ\\f\\xef\\xd7SA\\x950MQfz~)\\x13\\xc5\\xf1\\xf8\\x91\\x14\\x9d_\\xba\\x82[=M\\x81O\\x1dFNj\\xc1\\x98\\xe4&quot;\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS del \\$SECRETS_PATH/default/secret3\nError:  etcdserver: permission denied`, `22925233153961400000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># create_certificates viewsecrets</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get --keys-only --prefix=true /</span>\nError:  etcdserver: permission denied\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret3 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:secretbox:v1:key1:<span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\xf8\">\\xf8</span>,Q@<span class=\"token entity\" title=\"\\xb9\">\\xb9</span><span class=\"token entity\" title=\"\\xb6\">\\xb6</span>q3<span class=\"token variable\">$k</span><span class=\"token entity\" title=\"\\x04\">\\x04</span><span class=\"token entity\" title=\"\\xee\">\\xee</span>V<span class=\"token entity\" title=\"\\x99\">\\x99</span>|Z'<span class=\"token entity\" title=\"\\xde\">\\xde</span>E&lt;<span class=\"token entity\" title=\"\\xa5\">\\xa5</span><span class=\"token entity\" title=\"\\xa9\">\\xa9</span>n<span class=\"token entity\" title=\"\\x91\">\\x91</span>u<span class=\"token entity\" title=\"\\xb9\">\\xb9</span>]RY<span class=\"token entity\" title=\"\\xcc\">\\xcc</span>c<span class=\"token entity\" title=\"\\xe3\">\\xe3</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\x8b\">\\x8b</span><span class=\"token entity\" title=\"\\u07b4\">\\u07b4</span>Q<span class=\"token entity\" title=\"\\x91\">\\x91</span><span class=\"token entity\" title=\"\\x9c\">\\x9c</span>R2<span class=\"token entity\" title=\"\\xcc\">\\xcc</span><span class=\"token entity\" title=\"\\xc5\">\\xc5</span><span class=\"token entity\" title=\"\\xd9\">\\xd9</span><span class=\"token entity\" title=\"\\x0e\">\\x0e</span><span class=\"token entity\" title=\"\\x19\">\\x19</span>?<span class=\"token entity\" title=\"\\xca\">\\xca</span><span class=\"token entity\" title=\"\\x1c\">\\x1c</span>h<span class=\"token entity\" title=\"\\xde\">\\xde</span><span class=\"token entity\" title=\"\\x1d\">\\x1d</span>%<span class=\"token entity\" title=\"\\xa3\">\\xa3</span>N<span class=\"token entity\" title=\"\\x85\">\\x85</span>H<span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span>֢<span class=\"token entity\" title=\"\\xe6\">\\xe6</span><span class=\"token entity\" title=\"\\xab\">\\xab</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span><span class=\"token entity\" title=\"\\x96\">\\x96</span>0{<span class=\"token entity\" title=\"\\xdb\">\\xdb</span><span class=\"token entity\" title=\"\\xd8\">\\xd8</span>^eQ<span class=\"token entity\" title=\"\\xb3\">\\xb3</span><span class=\"token entity\" title=\"\\x05\">\\x05</span><span class=\"token entity\" title=\"\\x03\">\\x03</span><span class=\"token entity\" title=\"\\x06\">\\x06</span>)<span class=\"token entity\" title=\"\\x05\">\\x05</span>JH<span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\x18\">\\x18</span><span class=\"token entity\" title=\"\\f\">\\f</span>p<span class=\"token entity\" title=\"\\x9e\">\\x9e</span>u&lt;t<span class=\"token entity\" title=\"\\xea\">\\xea</span><span class=\"token entity\" title=\"\\x06\">\\x06</span><span class=\"token entity\" title=\"\\x12\">\\x12</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span>۹y<span class=\"token entity\" title=\"\\u007f\">\\u007f</span><span class=\"token entity\" title=\"\\x15\">\\x15</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\x1d\">\\x1d</span><span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\x8a\">\\x8a</span>2G<span class=\"token entity\" title=\"\\x85\">\\x85</span>'<span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\n\">\\n</span><span class=\"token entity\" title=\"\\x1d\">\\x1d</span><span class=\"token entity\" title=\"\\x99\">\\x99</span><span class=\"token entity\" title=\"\\x85\">\\x85</span>ku3<span class=\"token entity\" title=\"\\xa2\">\\xa2</span>~<span class=\"token entity\" title=\"\\x12\">\\x12</span><span class=\"token entity\" title=\"\\x04\">\\x04</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\x84\">\\x84</span>~<span class=\"token entity\" title=\"\\xaa\">\\xaa</span>G<span class=\"token entity\" title=\"\\xd3\">\\xd3</span>n<span class=\"token entity\" title=\"\\x98\">\\x98</span><span class=\"token entity\" title=\"\\x95\">\\x95</span><span class=\"token entity\" title=\"\\xa0\">\\xa0</span><span class=\"token entity\" title=\"\\xc8\">\\xc8</span>_1B<span class=\"token entity\" title=\"\\xcb\">\\xcb</span><span class=\"token entity\" title=\"\\x0f\">\\x0f</span><span class=\"token entity\" title=\"\\xb7\">\\xb7</span>;<span class=\"token entity\" title=\"\\x80\">\\x80</span><span class=\"token entity\" title=\"\\xe1\">\\xe1</span>xR<span class=\"token entity\" title=\"\\x86\">\\x86</span>ĳ<span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\xd7\">\\xd7</span>SA<span class=\"token entity\" title=\"\\x95\">\\x95</span>0MQfz~)<span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xc5\">\\xc5</span><span class=\"token entity\" title=\"\\xf1\">\\xf1</span><span class=\"token entity\" title=\"\\xf8\">\\xf8</span><span class=\"token entity\" title=\"\\x91\">\\x91</span><span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\x9d\">\\x9d</span>_<span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x82\">\\x82</span>[=M<span class=\"token entity\" title=\"\\x81\">\\x81</span>O<span class=\"token entity\" title=\"\\x1d\">\\x1d</span>FNj<span class=\"token entity\" title=\"\\xc1\">\\xc1</span><span class=\"token entity\" title=\"\\x98\">\\x98</span><span class=\"token entity\" title=\"\\xe4\">\\xe4</span>\"</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS del $SECRETS_PATH/default/secret3</span>\nError:  etcdserver: permission denied</code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<p>Check that 'usersecret4' can access only a specific key:</p>\n<div\n              class=\"gatsby-code-button-container\"\n              data-toaster-id=\"5333301272334845000\"\n              data-toaster-class=\"gatsby-code-button-toaster\"\n              data-toaster-text-class=\"gatsby-code-button-toaster-text\"\n              data-toaster-text=\"Copied\"\n              data-toaster-duration=\"5000\"\n              onClick=\"copyToClipboard(`# create_certificates usersecret4\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret3 -w fields | grep Value\nError:  etcdserver: permission denied\n# ETCDCTL_API=3 etcdctl \\$SSL_OPTS get \\$SECRETS_PATH/default/secret4 -w fields | grep Value\n&quot;Value&quot; : &quot;k8s:enc:secretbox:v1:key2:\\x92\\xeeyj\\x96\\xfc쵪-8\\x0e\\xa7\\x9a\\xb0\\x16\\xe2\\xb8J\\f_\\x81\\xec\\xf65\\xa9\\x1a\\xe5\\\\xۛ%Ҝ\\xbb\\ax\\xbf\\x00Kz\\xabaD\\x1c\\x94\\x87\\xaervsP\\xf3q\\xf3\\xaeH\\xb8\\x95-\\xef\\r*[yl\\xf3/\\xc4\\x0f\\x00\\a\\x132\\f\\xe1\\x17\\xbf\\xff\\xb4;<\\xec\\xc2\\x01\\xa8\\xc8f\\xff\\xcd\\xf3ʦ\\x83P\\x01\\xcdu\\x16\\x16\\xfa\\xba\\x8f\\xe6\\xe5\\x05\\x96\\xf7k,\\xaa\\xea\\x0f\\x99\\x8f\\xb3\\xc7\\xe6\\xa4=\\x93\\x8a\\xf3S\\x17\\xc6S\\r\\xee\\xea㟷\\x00\\x945o\\xe8\\x8e:W\\xacot\\xeaj,P\\x14\\xbe\\xd0\\x13\\xf91Y\\xf0\\xf0\\x93fW\\xcczD3\\xb9\\xa0\\xb4\\x9e\\xef\\x1aE\\x16\\xc8j_TX\\xae&quot;\n\\$ ETCDCTL_API=3 etcdctl \\$SSL_OPTS del \\$SECRETS_PATH/default/secret4\n1`, `5333301272334845000`)\"\n            >\n              <div\n                class=\"gatsby-code-button\"\n                data-tooltip=\"\"\n              >\n                <svg class=\"gatsby-code-button-icon\" xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path fill=\"none\" d=\"M0 0h24v24H0V0z\"/><path d=\"M16 1H2v16h2V3h12V1zm-1 4l6 6v12H6V5h9zm-1 7h5.5L14 6.5V12z\"/></svg>\n              </div>\n            </div>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre style=\"counter-reset: linenumber NaN\" class=\"language-shell line-numbers\"><code class=\"language-shell\"><span class=\"token comment\"># create_certificates usersecret4</span>\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret3 -w fields | grep Value</span>\nError:  etcdserver: permission denied\n<span class=\"token comment\"># ETCDCTL_API=3 etcdctl $SSL_OPTS get $SECRETS_PATH/default/secret4 -w fields | grep Value</span>\n<span class=\"token string\">\"Value\"</span> <span class=\"token builtin class-name\">:</span> <span class=\"token string\">\"k8s:enc:secretbox:v1:key2:<span class=\"token entity\" title=\"\\x92\">\\x92</span><span class=\"token entity\" title=\"\\xee\">\\xee</span>yj<span class=\"token entity\" title=\"\\x96\">\\x96</span><span class=\"token entity\" title=\"\\xfc\">\\xfc</span>쵪-8<span class=\"token entity\" title=\"\\x0e\">\\x0e</span><span class=\"token entity\" title=\"\\xa7\">\\xa7</span><span class=\"token entity\" title=\"\\x9a\">\\x9a</span><span class=\"token entity\" title=\"\\xb0\">\\xb0</span><span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\xe2\">\\xe2</span><span class=\"token entity\" title=\"\\xb8\">\\xb8</span>J<span class=\"token entity\" title=\"\\f\">\\f</span>_<span class=\"token entity\" title=\"\\x81\">\\x81</span><span class=\"token entity\" title=\"\\xec\">\\xec</span><span class=\"token entity\" title=\"\\xf6\">\\xf6</span>5<span class=\"token entity\" title=\"\\xa9\">\\xa9</span><span class=\"token entity\" title=\"\\x1a\">\\x1a</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\\\\">\\\\</span>xۛ%Ҝ<span class=\"token entity\" title=\"\\xbb\">\\xbb</span><span class=\"token entity\" title=\"\\a\">\\a</span>x<span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\x00\">\\x00</span>Kz<span class=\"token entity\" title=\"\\xab\">\\xab</span>aD<span class=\"token entity\" title=\"\\x1c\">\\x1c</span><span class=\"token entity\" title=\"\\x94\">\\x94</span><span class=\"token entity\" title=\"\\x87\">\\x87</span><span class=\"token entity\" title=\"\\xae\">\\xae</span>rvsP<span class=\"token entity\" title=\"\\xf3\">\\xf3</span>q<span class=\"token entity\" title=\"\\xf3\">\\xf3</span><span class=\"token entity\" title=\"\\xae\">\\xae</span>H<span class=\"token entity\" title=\"\\xb8\">\\xb8</span><span class=\"token entity\" title=\"\\x95\">\\x95</span>-<span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\r\">\\r</span>*[yl<span class=\"token entity\" title=\"\\xf3\">\\xf3</span>/<span class=\"token entity\" title=\"\\xc4\">\\xc4</span><span class=\"token entity\" title=\"\\x0f\">\\x0f</span><span class=\"token entity\" title=\"\\x00\">\\x00</span><span class=\"token entity\" title=\"\\a\">\\a</span><span class=\"token entity\" title=\"\\x13\">\\x13</span>2<span class=\"token entity\" title=\"\\f\">\\f</span><span class=\"token entity\" title=\"\\xe1\">\\xe1</span><span class=\"token entity\" title=\"\\x17\">\\x17</span><span class=\"token entity\" title=\"\\xbf\">\\xbf</span><span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span>;&lt;<span class=\"token entity\" title=\"\\xec\">\\xec</span><span class=\"token entity\" title=\"\\xc2\">\\xc2</span><span class=\"token entity\" title=\"\\x01\">\\x01</span><span class=\"token entity\" title=\"\\xa8\">\\xa8</span><span class=\"token entity\" title=\"\\xc8\">\\xc8</span>f<span class=\"token entity\" title=\"\\xff\">\\xff</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span><span class=\"token entity\" title=\"\\xf3\">\\xf3</span>ʦ<span class=\"token entity\" title=\"\\x83\">\\x83</span>P<span class=\"token entity\" title=\"\\x01\">\\x01</span><span class=\"token entity\" title=\"\\xcd\">\\xcd</span>u<span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\xfa\">\\xfa</span><span class=\"token entity\" title=\"\\xba\">\\xba</span><span class=\"token entity\" title=\"\\x8f\">\\x8f</span><span class=\"token entity\" title=\"\\xe6\">\\xe6</span><span class=\"token entity\" title=\"\\xe5\">\\xe5</span><span class=\"token entity\" title=\"\\x05\">\\x05</span><span class=\"token entity\" title=\"\\x96\">\\x96</span><span class=\"token entity\" title=\"\\xf7\">\\xf7</span>k,<span class=\"token entity\" title=\"\\xaa\">\\xaa</span><span class=\"token entity\" title=\"\\xea\">\\xea</span><span class=\"token entity\" title=\"\\x0f\">\\x0f</span><span class=\"token entity\" title=\"\\x99\">\\x99</span><span class=\"token entity\" title=\"\\x8f\">\\x8f</span><span class=\"token entity\" title=\"\\xb3\">\\xb3</span><span class=\"token entity\" title=\"\\xc7\">\\xc7</span><span class=\"token entity\" title=\"\\xe6\">\\xe6</span><span class=\"token entity\" title=\"\\xa4\">\\xa4</span>=<span class=\"token entity\" title=\"\\x93\">\\x93</span><span class=\"token entity\" title=\"\\x8a\">\\x8a</span><span class=\"token entity\" title=\"\\xf3\">\\xf3</span>S<span class=\"token entity\" title=\"\\x17\">\\x17</span><span class=\"token entity\" title=\"\\xc6\">\\xc6</span>S<span class=\"token entity\" title=\"\\r\">\\r</span><span class=\"token entity\" title=\"\\xee\">\\xee</span><span class=\"token entity\" title=\"\\xea\">\\xea</span>㟷<span class=\"token entity\" title=\"\\x00\">\\x00</span><span class=\"token entity\" title=\"\\x94\">\\x94</span>5o<span class=\"token entity\" title=\"\\xe8\">\\xe8</span><span class=\"token entity\" title=\"\\x8e\">\\x8e</span>:W<span class=\"token entity\" title=\"\\xac\">\\xac</span>ot<span class=\"token entity\" title=\"\\xea\">\\xea</span>j,P<span class=\"token entity\" title=\"\\x14\">\\x14</span><span class=\"token entity\" title=\"\\xbe\">\\xbe</span><span class=\"token entity\" title=\"\\xd0\">\\xd0</span><span class=\"token entity\" title=\"\\x13\">\\x13</span><span class=\"token entity\" title=\"\\xf9\">\\xf9</span>1Y<span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\xf0\">\\xf0</span><span class=\"token entity\" title=\"\\x93\">\\x93</span>fW<span class=\"token entity\" title=\"\\xcc\">\\xcc</span>zD3<span class=\"token entity\" title=\"\\xb9\">\\xb9</span><span class=\"token entity\" title=\"\\xa0\">\\xa0</span><span class=\"token entity\" title=\"\\xb4\">\\xb4</span><span class=\"token entity\" title=\"\\x9e\">\\x9e</span><span class=\"token entity\" title=\"\\xef\">\\xef</span><span class=\"token entity\" title=\"\\x1a\">\\x1a</span>E<span class=\"token entity\" title=\"\\x16\">\\x16</span><span class=\"token entity\" title=\"\\xc8\">\\xc8</span>j_TX<span class=\"token entity\" title=\"\\xae\">\\xae</span>\"</span>\n$ <span class=\"token assign-left variable\">ETCDCTL_API</span><span class=\"token operator\">=</span><span class=\"token number\">3</span> etcdctl <span class=\"token variable\">$SSL_OPTS</span> del <span class=\"token variable\">$SECRETS_PATH</span>/default/secret4\n<span class=\"token number\">1</span></code><span aria-hidden=\"true\" class=\"line-numbers-rows\" style=\"white-space: normal; width: auto; left: 0;\"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></pre></div>\n<h2>Conclusion</h2>\n<p>In a cluster with multiple masters, where etcd servers listen on all interfaces and not on localhost, limiting the access to etcd is vital.<br>\nKubernetes manages this with RBAC, but by default etcd is only protected by requiring the client to have a valid certificate.<br>\nWhile employing EncryptionConfig can take care of most of the issues, it is still possible to have data in etcd that is not fully encrypted. Since confidential data can now be required in configmaps, even in statefulsets and deployments as environment variables, using simply EncryptionConfig is not sufficient.<br>\nIf you cut access entirely to etcd by using authentication and only allow the apiserver to connect, you protect yourself from leaking sensitive data to others. You can create short lived certificates for any other uses and no longer need to worry about the longevity of the certificates.<br>\nThe solution is also applicable to the users added previously to etcd: if you don't feel confident about what happened to certificates created for them before, you can revoke the users access, or delete them.</p>","frontmatter":{"url":"securing-kubernetes-secrets-how-to-efficiently-secure-access-to-etcd-and-protect-your-secrets","seo":{"title":"Securing Kubernetes secrets: How to efficiently secure access to etcd and protect your secrets","description":"Etcd is a distributed, consistent and highly-available key value store used as the Kubernetes backing store for all cluster data, making it a core component of every K8s deployment. Due to its central role etcd may contain sensitive information related to access of the deployed services and their associated components,","canonical":null,"image":{"childImageSharp":{"fluid":{"aspectRatio":0.7418397626112759,"src":"/static/62bd016a89ce5970467a24df70a52cf0/724c8/close-up-door-golden-67537.jpg","srcSet":"/static/62bd016a89ce5970467a24df70a52cf0/84d81/close-up-door-golden-67537.jpg 250w,\n/static/62bd016a89ce5970467a24df70a52cf0/f0719/close-up-door-golden-67537.jpg 500w,\n/static/62bd016a89ce5970467a24df70a52cf0/724c8/close-up-door-golden-67537.jpg 1000w,\n/static/62bd016a89ce5970467a24df70a52cf0/d79bd/close-up-door-golden-67537.jpg 1500w,\n/static/62bd016a89ce5970467a24df70a52cf0/a66ad/close-up-door-golden-67537.jpg 2000w,\n/static/62bd016a89ce5970467a24df70a52cf0/fb46d/close-up-door-golden-67537.jpg 2820w","srcWebp":"/static/62bd016a89ce5970467a24df70a52cf0/36ebb/close-up-door-golden-67537.webp","srcSetWebp":"/static/62bd016a89ce5970467a24df70a52cf0/1d872/close-up-door-golden-67537.webp 250w,\n/static/62bd016a89ce5970467a24df70a52cf0/4e6d4/close-up-door-golden-67537.webp 500w,\n/static/62bd016a89ce5970467a24df70a52cf0/36ebb/close-up-door-golden-67537.webp 1000w,\n/static/62bd016a89ce5970467a24df70a52cf0/fd45d/close-up-door-golden-67537.webp 1500w,\n/static/62bd016a89ce5970467a24df70a52cf0/6e77b/close-up-door-golden-67537.webp 2000w,\n/static/62bd016a89ce5970467a24df70a52cf0/d0805/close-up-door-golden-67537.webp 2820w","sizes":"(max-width: 1000px) 100vw, 1000px","maxHeight":1348,"maxWidth":1000}}}},"title":"Securing Kubernetes secrets: How to efficiently secure access to etcd and protect your secrets","date":"2018-06-20T16:00:00.000Z","tags":["Kubernetes","Security"],"author":{"name":"MyOps","photo":{"extension":"png","publicURL":"/static/3ff870573bc56665ee67e3cf3f5fc163/logo-small.png","childImageSharp":{"fluid":{"aspectRatio":0.8759124087591241,"src":"/static/3ff870573bc56665ee67e3cf3f5fc163/b460a/logo-small.png","srcSet":"/static/3ff870573bc56665ee67e3cf3f5fc163/d966b/logo-small.png 120w,\n/static/3ff870573bc56665ee67e3cf3f5fc163/67196/logo-small.png 240w,\n/static/3ff870573bc56665ee67e3cf3f5fc163/b460a/logo-small.png 480w,\n/static/3ff870573bc56665ee67e3cf3f5fc163/eec14/logo-small.png 596w","srcWebp":"/static/3ff870573bc56665ee67e3cf3f5fc163/35871/logo-small.webp","srcSetWebp":"/static/3ff870573bc56665ee67e3cf3f5fc163/83552/logo-small.webp 120w,\n/static/3ff870573bc56665ee67e3cf3f5fc163/2b5a3/logo-small.webp 240w,\n/static/3ff870573bc56665ee67e3cf3f5fc163/35871/logo-small.webp 480w,\n/static/3ff870573bc56665ee67e3cf3f5fc163/c0cb3/logo-small.webp 596w","sizes":"(max-width: 480px) 100vw, 480px"}}}},"image":{"childImageSharp":{"fluid":{"aspectRatio":0.7425742574257426,"src":"/static/62bd016a89ce5970467a24df70a52cf0/8c3c2/close-up-door-golden-67537.jpg","srcSet":"/static/62bd016a89ce5970467a24df70a52cf0/15aed/close-up-door-golden-67537.jpg 300w,\n/static/62bd016a89ce5970467a24df70a52cf0/a07a5/close-up-door-golden-67537.jpg 600w,\n/static/62bd016a89ce5970467a24df70a52cf0/8c3c2/close-up-door-golden-67537.jpg 1200w,\n/static/62bd016a89ce5970467a24df70a52cf0/cd33f/close-up-door-golden-67537.jpg 1800w,\n/static/62bd016a89ce5970467a24df70a52cf0/1c8c6/close-up-door-golden-67537.jpg 2400w,\n/static/62bd016a89ce5970467a24df70a52cf0/0860c/close-up-door-golden-67537.jpg 2820w","srcWebp":"/static/62bd016a89ce5970467a24df70a52cf0/e7405/close-up-door-golden-67537.webp","srcSetWebp":"/static/62bd016a89ce5970467a24df70a52cf0/4fec1/close-up-door-golden-67537.webp 300w,\n/static/62bd016a89ce5970467a24df70a52cf0/483a3/close-up-door-golden-67537.webp 600w,\n/static/62bd016a89ce5970467a24df70a52cf0/e7405/close-up-door-golden-67537.webp 1200w,\n/static/62bd016a89ce5970467a24df70a52cf0/7f800/close-up-door-golden-67537.webp 1800w,\n/static/62bd016a89ce5970467a24df70a52cf0/7acea/close-up-door-golden-67537.webp 2400w,\n/static/62bd016a89ce5970467a24df70a52cf0/065c4/close-up-door-golden-67537.webp 2820w","sizes":"(max-width: 1200px) 100vw, 1200px"}}}}}},"pageContext":{"id":"de123c5a-afe4-50f1-82ad-eb81f1b9843a","categories":["Kubernetes","Security"]}},"staticQueryHashes":["2022990323","639612397"]}