{"id":305,"date":"2018-10-16T08:18:09","date_gmt":"2018-10-16T08:18:09","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw93\/?p=305"},"modified":"2018-10-16T20:48:53","modified_gmt":"2018-10-16T20:48:53","slug":"native-x509-certificate-management-for-kubernetes-jetstack-blog","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/16\/native-x509-certificate-management-for-kubernetes-jetstack-blog\/","title":{"rendered":"native x509 certificate management for Kubernetes \/\/ Jetstack Blog"},"content":{"rendered":"<p>2\/May 2018<\/p>\n<p>By <a target=\"\">James Munnelly<\/a><\/p>\n<p>Those of you who closely follow Jetstack\u2019s <a href=\"https:\/\/www.jetstack.io\/open-source\">open source projects<\/a> may have already noticed that our<br \/>\nnew certificate management tool, <a href=\"https:\/\/github.com\/jetstack\/cert-manager\">cert-manager<\/a>, has been available for some time now.<br \/>\nIn fact, we now have over 1,000 stars on GitHub!<\/p>\n<p>Cert-manager is a general purpose x509 certificate management tool for Kubernetes.<br \/>\nIn today\u2019s modern web, securing application traffic is critical.<br \/>\ncert-manager aims to simplify management, issuance and renewal of certificates within your<br \/>\norganisation.<\/p>\n<p><a href=\"https:\/\/github.com\/jetstack\/kube-lego\">kube-lego<\/a>, our <a href=\"https:\/\/blog.jetstack.io\/blog\/kube-lego\/\">original<\/a> <a href=\"https:\/\/www.letsencrypt.org\">Let\u2019s Encrypt<\/a> certificate provisioning<br \/>\ntool for Kubernetes Ingress resources, has been a great success.<br \/>\nIt makes securing traffic between your users and your cluster ingress point simple.<br \/>\nOver time however, the limitations of building a controller solely around Kubernetes Ingresses<br \/>\nbecame apparent.<\/p>\n<p>By building cert-manager around Kubernetes <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/api-extension\/custom-resources\/\">CustomResourceDefinitions<\/a>, we have been able to<br \/>\ngreatly increase the flexibility of configuration, debugging capabilities and also support a wider<br \/>\nrange of CAs than Let\u2019s Encrypt alone.<\/p>\n<p>This post is a high-level overview of how cert-manager works, and will highlight<br \/>\nsome of the new features and recent developments in the project.<\/p>\n<p>In the real world of x509 certificates, CAs (Certificate Authorities) are a point of trust, responsible<br \/>\nfor issuing identities to various clients in the form of signed and trusted x509 certificates.<\/p>\n<p>Let\u2019s Encrypt introduced the ACME protocol, however, not all CAs support this protocol.<\/p>\n<p>In order to support many different types of certificate authority, we have introduced the concept of<br \/>\na CA to the Kubernetes API, in the form of \u2018Issuers\u2019.<\/p>\n<p>A cert-manager \u2018Issuer\u2019 resource represents an entity that is able to sign x509 Certificate<br \/>\nrequests.<\/p>\n<p>Today, we support ACME, CA (i.e. a simple signing keypair stored in a Secret resource) and as of<br \/>\nthe v0.3.0 release, Hashicorp Vault!<\/p>\n<p>Here\u2019s an example of an issuer resource:<\/p>\n<p>apiVersion: certmanager.k8s.io\/v1alpha1<br \/>\nkind: ClusterIssuer<br \/>\nmetadata:<br \/>\nname: letsencrypt-staging<br \/>\nspec:<br \/>\nacme:<br \/>\nserver: https:\/\/acme-staging-v02.api.letsencrypt.org\/directory<br \/>\nemail: user@example.com<br \/>\nprivateKeySecretRef:<br \/>\nname: letsencrypt-private-key<br \/>\nhttp01: {}<\/p>\n<p>In order to request certificates from these Issuers, we also introduce Certificate resources.<br \/>\nThese resources reference a corresponding Issuer resource in order to denote which CA they should<br \/>\nbe issued by.<\/p>\n<p>Here\u2019s an example of a certificate resource, using the issuer shown previously:<\/p>\n<p>apiVersion: certmanager.k8s.io\/v1alpha1<br \/>\nkind: Certificate<br \/>\nmetadata:<br \/>\nname: example-com<br \/>\nspec:<br \/>\nsecretName: example-com-tls<br \/>\ndnsNames:<br \/>\n&#8211; example.com<br \/>\n&#8211; www.example.com<br \/>\nissuerRef:<br \/>\nname: letsencrypt-staging<br \/>\nkind: ClusterIssuer<br \/>\nacme:<br \/>\nconfig:<br \/>\n&#8211; http01:<br \/>\ningressClass: nginx<br \/>\ndomains:<br \/>\n&#8211; example.com<br \/>\n&#8211; www.example.com<\/p>\n<p>More info on Issuers and Certificates can be found in our <a href=\"https:\/\/cert-manager.readthedocs.io\/\">documentation<\/a>.<\/p>\n<p>Over the last few weeks, we have been trialling an alpha release candidate of v0.3,<br \/>\nour upcoming new release.<\/p>\n<p>This release is packed with new features and bug fixes alike, and this section describes<br \/>\nthe headline features.<\/p>\n<h2>ACMEv2 and wildcard certificates<\/h2>\n<p>Let\u2019s Encrypt recently announced v2 of the ACME protocol, which amongst other improvements,<br \/>\nnow supports wildcard certificates. This has been a long-awaited and requested feature,<br \/>\nand one that hasn\u2019t been possible until recently.<\/p>\n<p>In order to allow cert-manager users to request and consume wildcard certificates, we have<br \/>\nswitched exclusively to use ACMEv2 as part of the v0.3 release.<\/p>\n<p>This allows users to request wildcard certificates just like any other &#8211; including full support<br \/>\nfor doing so via annotated Ingress resources (just like kube-lego!).<\/p>\n<p>This is a great example of how we can add new and more complex features to cert-manager, whilst<br \/>\nalso continuing to support long-standing, legacy behaviour adopted from kube-lego.<\/p>\n<p>If you\u2019d like to get started and give this a try, check out the latest v0.3 alpha release<br \/>\non our GitHub page. You can request a wildcard certificate just like any other, by specifying<br \/>\n*.domain.com as one of your DNS names. See the <a href=\"http:\/\/docs.cert-manager.io\/en\/master\/tutorials\/acme\/dns-validation.html\">ACME DNS validation tutorial<\/a> for more information<br \/>\non how to get started with the DNS-01 challenge.<\/p>\n<h2>Vault Issuer support<\/h2>\n<p>After a lot of hard work, initial support for <a href=\"https:\/\/vaultproject.io\/\">Hashicorp Vault<\/a> has been merged into cert-manager!<\/p>\n<p>This is another long requested feature, and a large addition to our set of supported Issuer types.<\/p>\n<p>A special thanks to <a href=\"https:\/\/github.com\/vdesjardins\">@vdesjardins<\/a>, who single handedly and unprompted undertook this work, driving<br \/>\nit through the review process to the very end.<\/p>\n<p>This allows end users to create a \u2018Vault\u2019 Issuer, which is paired with a single Vault PKI backend role.<\/p>\n<p>Initially we support both token authentication and Vault\u2019s \u2018AppRole\u2019 authentication mechanism<br \/>\nto securely authorize cert-manager against the Vault server.<\/p>\n<p>The addition of the Vault Issuer bolsters our position as a general purpose certificate<br \/>\nmanager, and shows the value in providing a single clean abstraction on top of the multitude<br \/>\nof different types of CAs out there.<\/p>\n<p>Read more about <a href=\"http:\/\/docs.cert-manager.io\/en\/latest\/tutorials\/index.html\">creating and using the Vault Issuer<\/a> at the docs.<\/p>\n<h2>New documentation site<\/h2>\n<p>Within any project, documentation is tough. It needs to provide a clear onboarding experience<br \/>\nfor brand new users, as well as in-depth details for more advanced users. All the while accounting<br \/>\nfor the varying skill levels of these users (for example, some may also be brand new to Kubernetes<br \/>\nitself!).<\/p>\n<p>We\u2019ve had some brilliant community contributions with user guides and tutorials explaining how<br \/>\nto get started with cert-manager.<\/p>\n<p>Up until now, we have used markdown stored in GitHub to host our documentation.<br \/>\nThis began to cause confusion when we started versioning cert-manager more strictly, and<br \/>\nreleasing alpha\/beta release candidates.<br \/>\nIn order to handle this, and also to make it easier for users to navigate and discover the<br \/>\nvarious tutorials we <em>do<\/em> have &#8211; we have moved our documentation over to a hosted readthedocs<br \/>\nwebsite.<\/p>\n<p>You can check out the new docs on <a href=\"https:\/\/cert-manager.readthedocs.io\/\">readthedocs<\/a> &#8211; take note<br \/>\nthat we have a \u2018version switcher\u2019 in the bottom left as well, if you are looking for info on the<br \/>\nlatest 0.3 release.<\/p>\n<p>Each page in the docs also has an \u201cEdit in GitHub\u201d link on the top right, so if you spot a mistake<br \/>\nor if you\u2019ve got an idea for a new tutorial please dive in and submit PRs!<\/p>\n<p>Cert-manager is still young, with much planned in the future! Here are a couple of highlights<br \/>\nfrom our roadmap:<\/p>\n<h2>Defining Policy on Certificates<\/h2>\n<p>Right now, any user that is able to create a Certificate resource can request certificates<br \/>\nof any sort from any ClusterIssuer, or Issuer within the same namespace.<\/p>\n<p>We intend to provide mechanisms for administrators to define \u2018policies\u2019 for who can obtain<br \/>\nCertificates, and\/or how those Certificates must be structured. This might include things such<br \/>\nas minimum and maximum durations, or a limited set of allowed DNS names.<\/p>\n<p>By defining this policy within Kubernetes itself, we benefit from a common level of policy<br \/>\ncontrol between all the different CAs within an organisation.<br \/>\nThis will help your organisation audit and manage who can do what.<\/p>\n<h2>Advanced resource validation<\/h2>\n<p>Kubernetes has recently added support for ValidatingAdmissionWebhooks (as well as their \u2018Mutating\u2019 counterparts).<\/p>\n<p>These can be used to provide resource validation (e.g. ensuring that all fields are set to<br \/>\nacceptable values), as well as advanced \u2018mutation\u2019 of resources (e.g. applying \u2018default values\u2019).<\/p>\n<p>One common problem when configuring these webhooks, is that they require x509 Certificates in order<br \/>\nto be set up and run. This process can be cumbersome, and is exactly the sort of problem cert-manager<br \/>\nhas been designed to solve!<\/p>\n<p>In future releases of cert-manager, we will introduce <em>our own<\/em> Validating webhook in<br \/>\norder to provide fore-warning to developers of invalid configurations. This will involve<br \/>\na novel \u2018bootstrapping\u2019 process in order to allow for \u2018self hosted webhooks\u2019 (i.e. webhooks that<br \/>\npower cert-manager, hosted by cert-manager).<\/p>\n<p>Along with this, we will be creating tutorials that explain our \u2018recommended deployment practice\u2019<br \/>\nfor these kinds of webhooks, and how you can utilise cert-manager to handle all aspects of securing them!<\/p>\n<h2>Pluggable\/out-of-process Issuers<\/h2>\n<p>Some enterprise users of cert-manager have their own CA process, which is novel and bespoke<br \/>\nto their organisation.<\/p>\n<p>It is not always feasible to switch a whole organisation over to a new protocol in a short period,<br \/>\ngiven so many different business units rely on a x509 Certificate platform.<\/p>\n<p>In order to ease the transition period for these companies, we are exploring the addition<br \/>\nof a \u2018gRPC based Issuer\u2019.<br \/>\nThis is in a similar vein to CNI (Container Networking Interface) and CRI (Container Runtime Interface).<br \/>\nThe goal would be to provide a general purpose gRPC interface that anyone can implement<br \/>\nin order to sign and renew certificates.<\/p>\n<p>Users that implement this interface will then immediately benefit from the additional<br \/>\npolicy and renewal features that cert-manager already implements.<\/p>\n<p>Cert-manager is growing quickly, and the community around it bolsters every day.<\/p>\n<p>We\u2019d love to see new members join the community, and believe it\u2019s imperative if we<br \/>\nwant the project to survive.<\/p>\n<p>If you want to get involved, take a look over our Issue board on GitHub, or drop into<br \/>\n#cert-manager on the <a href=\"https:\/\/slack.k8s.io\">Kubernetes Slack<\/a> and say hello!<\/p>\n<p>Want to work on community projects like cert-manager for your day job?<br \/>\nJetstack are hiring Software Engineers, including remote (EU) roles. Check out our <a href=\"https:\/\/www.jetstack.io\/careers\">careers page<\/a><br \/>\nfor more info on the roles and how to apply.<\/p>\n<p><a href=\"https:\/\/blog.jetstack.io\/blog\/cert-manager\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>2\/May 2018 By James Munnelly Those of you who closely follow Jetstack\u2019s open source projects may have already noticed that our new certificate management tool, cert-manager, has been available for some time now. In fact, we now have over 1,000 stars on GitHub! Cert-manager is a general purpose x509 certificate management tool for Kubernetes. In &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw93\/index.php\/2018\/10\/16\/native-x509-certificate-management-for-kubernetes-jetstack-blog\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;native x509 certificate management for Kubernetes \/\/ Jetstack Blog&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-kubernetes"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/comments?post=305"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/posts\/305\/revisions\/411"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/media?parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/categories?post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw93\/index.php\/wp-json\/wp\/v2\/tags?post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}