Skip to content

K8s retool: Introducing "Cabotage" #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 121 commits into from
Sep 27, 2018
Merged

K8s retool: Introducing "Cabotage" #3

merged 121 commits into from
Sep 27, 2018

Conversation

ewdurbin
Copy link
Member

@ewdurbin ewdurbin commented Dec 29, 2017

This PR Is a WIP until documentation and READMEs show up... but here's the 50,000 foot view!

Disclaimer: Beware sharp bash edges :)

TLS

Consul Bootstrapping

Vault Bootstrapping

Vault Kubernetes Auth Backend

Cabotage "Enrollment"

Cabotage Sidecar

  • This behemoth has two entry points, kube_login intended as an initContainer, and maintain which is intended to run as a sidecar to Pods.
  • As an example, a splendid Vault UI called Goldfish is deployable.
  • kube_login allows for a container to fetch a vault token, storing it for later use either in clear text or as a wrapped response for another container to manage. Optionally, a TLS Certificate signed by the automated Intermediate Certificate Authority can fetched, as well as a Consul Token which has limited access to a prefix in Consul's KV store.
  • The kube_login entry point is intended to execute once... meaning that anything obtained by it will expire when it's Lease expires.
  • Enter the maintain side car! This sidecar will keep the Vault Token obtained by kube_login renewed, as well optionally the Consul Token and TLS certificate.
  • Bonus: Clients may drop files into leases directory of known path containing Vault Lease IDs and the maintain loop will work to renew them

Goldfish

  • A Goldfish was used during development as a testbed, with the big benefit of giving easy access to check Vault policy creation along the way. Shoutout to @Caiyeon.
  • This deployment leverages a few features of our enrollment and sidecar!
  • By applying the label specified to the cabotage-enrollment-controller to our ServiceAccount for Goldfish it is granted access!
  • An initContainer fetches a token from vault with the specified Kubernetes Auth Backend role and stores it unwrapped for Goldfish to access at startup.
  • Additionally, the Goldfish Pod obtains access to and uses TLS certificates issued by the Intermediate CA.
  • The sidecar then runs along side the pod keeping the TLS certificates and vault token renewed.
  • With minor improvements, Goldfish should be extendable to obtain all the necessary SubjectAlternativeNames in order to remove the need for the sidecar all-together.
  • In an ideal world, the sidecar process is not necessary and applications retrieve, use, and renew their own Leases for secrets from Vault :).
  • Even more ideal is for the kube_login initContainer to not be required to ever even have the token, but rather to write a wrapped response which the service itself can unwrap and use. This is supported by the kube_login command by supplying the --no-unwrap flag.

Known Issues:

  • Vault Audit Logs must be enabled before deploying to production
  • Policies for TLS Certificate Issuance are laughably lax and should be tightened up.
  • ??? Please comment <3

Next Steps:

  • From here, the next layer up is a service/controller for managing services! We'll use something like envconsul to fetch Environment Variable for configuration from Consul/Vault.
  • Some simple UI/cli for authorized users to set but not retrieve secure environment variables via Vault.
  • Some simple UI/cli for authorized user to set and retrieve plaintext environment variables via Consul.
  • Ingress and LetsEncrypt!
  • Automation for deployment of Dockerfiles or container images provided by users into Deployments
  • Automation for rollbacks.
  • Automation for 🔴/⚫️ and or 💚/💙 style rollouts.
  • Automation for Canary 🐦 deployments.
  • Automation for versioned configurations, including overlays/overrides for canaries.

acl_agent_token _must_ be supplied in a file, so we might as well move gossip encryption key over as well
- rotate acl_agent_token only if necessary
- rotate out a bootstrapping gossip encryption key
i mean the unseal keys are in memory right now anyway
@ewdurbin ewdurbin merged commit f827d08 into master Sep 27, 2018
@ewdurbin ewdurbin deleted the k8s-retool branch September 27, 2018 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant