DevOps & Private Equity

DevOps & Private Equity

Archive
Log in
Subscribe
June 11, 2024

[DevOps & Private Equity] 4 Expert Level DevOps Secrets Explained

The kind you know by having been there. Some may be a surprise, but I'll tell you exactly why.

View this email in your browser
A monthly dose of DevOps from the private equity perspective.
This is a new piece that new subscribers get when they sign up for the mailing list.  Now you have it too!  Know someone who should be reading content like this? Encourage them to sign up!
There are probably a million articles about DevOps if not more.  With generative AI, it’s probably more.  Most of the advice (like much in my book DevOps Patterns for Private Equity) is about how CI/CD is important, that you should strive for small batch deployments, or that you should monitor your infrastructure.  Those things are true.

What about lessons that aren’t things that are simply logical but are hard earned?  The stuff you only know about after operating at large scale and high transaction rates, learned over many years.  

Here are four secrets to DevOps success that I teach my clients, that no one has ever explained to you, and why they are so important.
 

Secrets


How can we begin a discussion about DevOps secrets  without content about secrets?
 
Secrets must be behind an API.  They must be versioned.  You must be able to rotate them easily and automatically.

There are lots of ways to do this of course.  In the past, we had vaults where there were secrets to unlock the vault and that secret had to be rotated periodically.  The software has gotten more sophisticated, but at this point you’re probably better off just using the secrets service offered by your cloud provider.  Access to this vault relies on identity instead of having access to a shared secret.  This is much stronger authentication.
  • Identity is a lot harder to steal than a secret.  If someone leaves a company, you disable their identity. There is no need to rotate all the passwords (though you should) because they no longer have access.  Not surprisingly, this identity over secrets principle is at the core of Zero Trust architectures.
  • The danger of secrets being leaked is so prevalent that GitHub has their Secrets Scanning service turn on automatically for all public repositories and npm packages.
  • With the API, developers don’t have to worry or care about the authentication.  Just like with a human, machines that need to access a secret can prove their identity.  When IAM is configured properly and working properly, the right resources have access to the right things.
  • Password rotation can become a thing of the past.  Using IAM Roles on AWS, the default credential lifetime is 1 hour.  To do better, you’d have to design your system for rotating your credentials at least  24 times a day.  Even secrets themselves can be rotated often because they do not need to be shared with anyone.  They are retrieved as necessary.
  • All secret management systems have audit trails to help you align with your compliance needs (HIPAA, PCI-DSS, etc.)
  • Because we are relying on identity (natural person or machine or service), access control can be extremely granular.  With the old vault systems, unless you wanted to manage multiple vaults/buckets, access was extremely coarse, and often too broad.
  • You can manage each environment’s secrets separately.   This can be extremely important in highly regulated industries.  For example, non-US citizens may have access to credentials in the development environment, but not production.
  • One of the big problems with the vaults is where to store them?  Where is secure enough to store them?  An S3 bucket?  There are countless stories of S3 buckets leaking secrets.
 

Artifacts and config are separate

 
There are a lot of different things we can ship to our environments.  Zip files, WAR files, containers, etc. are all examples of artifacts.  Often these artifacts are stored in a repository designed specifically for this purpose (e.g. Amazon Elastic Container Registry).  The exact same artifact should be deployed in every environment.  You should be able to take a checksum of an artifact in the Development environment and get the exact same checksum by the time it reaches Production.  

But, these environments are different.  For example, we’re not going to use the production database in the development environment.  How can the artifact be different?
 
Artifacts and configuration must be handled separately.  Different configs can be used with the same artifact and each should be shippable independently.

This means that it’s entirely possible to cause a production outage by shipping a new configuration (e.g. pointing at a non-existent database) without touching any code.  In spite of this potential downside, managing configuration separately from code has many advantages.
  • Because we are promoting the exact same artifact through our environments, we can have a lot more faith in our testing.  We are testing the same bits from Development through Production.  If the software operated properly in testing, there is a better chance it will operate well in production.
  • We can have more confidence in our software supply chain.  We know what was built from source control and we can verify that exact same thing is what is being exposed to our customers.  If we generate an SBOM (Software Bill Of Materials), then we can be sure that the software inside is exactly what is written on the tin.
  • Being able to ship configuration separately means we are able to make infrastructure changes easily.  Need to point at a new database?  No problem.  Want to test a different API endpoint?  Piece of cake.  All without having to do a new software release.
  • When the configuration is separate from the artifact, it is easier to understand and reason about.  If you want to know which Azure resources a service consumes, you can look at the configuration and see.  Easily.  
  • This pattern is something that experienced operators have been using for years.  When containers came along, it was formalized.  This is why it was such a big deal that containers were immutable.  The configuration is separate from the artifact.  If you deploy your applications on Kubernetes, the best practice is not to create complicated YAML files.  It is to mount the configuration from persistent storage so that you can redeploy the software as needed.
  • By keeping them separate, they can be secured separately.  Perhaps Ops has permission to change configuration but can’t change the code.  Perhaps the developers can only make changes to the code.  Perhaps people in different parts of the world can only have access to certain environments.  When these are shippable independently, it is much easier to implement these granular controls.
 

Infrastructure is disposable

 
We’ve all heard the analogy about cattle vs. pets.  Cattle are things that you can treat as a herd, adding and removing at will, while pets are things you lovingly take care of for as long as possible, up to and including heroics.  When you’re responsible for real infrastructure and customers will not tolerate downtime, your pet systems cause downtime, and limit your scalability.  Also, we’re not necessarily talking about stateful infrastructure (don’t just delete all your customer’s files), but even that should be relatively easy to reconstitute.

John Willis (one of the authors of The DevOps Handbook, in which I make a guest appearance) used to say you were doing infrastructure right if you could go into the datacenter, open a window (if they had windows) and toss out a piece of equipment from a rack.  If you could get an exact replica of that machine in minutes, you were doing it correctly.
 
You should be able to destroy any stateless piece of your infrastructure and get an exact replica in minutes.

Today we hopefully are no longer maintaining equipment in data centers.  However, the same principle applies in our cloud environments.  Some cloud services make this very well defined and crystal clear.  Having this ability yields tremendous benefits far beyond simply building things faster.
  • Instead of being able to replace machines reliably, we can replace entire environments reliably.  If an Infrastructure-as-Code module is written to build something and we can vary just the configuration (see secret #2!) between environments, we can have more confidence that the testing we do in those environments is worthwhile.  There is no longer a concern that pre-prod was built differently than production.  They are identical in all important respects.
  • This can also help to make disaster recovery/business continuity a breeze.  If the stateful elements are replicated to another location, we can build the new environment in short order.  We don’t need to have a lot of infrastructure idling needlessly in case there is an event.  We can build it at will.
  • Automatically (or on a schedule) scaling of the environments is simplified.  Your foundational elements may only vary slightly (e.g. IP address) and are otherwise identical because they were built from the same template.  We see Kubernetes do this all the time with the replicas: parameter.  Machines/containers/etc. are identical and disposable, which allow for easy deployments and easy scaling.
  • Capacity planning is straightforward.  If we use our ability to change configuration to test our different configurations of compute/memory/storage to find the optimal configurations, then those optimized parameters will be guaranteed to be present going forward.  No more hoping that the runbook was followed correctly.  While the sizes may vary from environment to environment, the foundation of the infrastructure will be the same.
  • Failures are easily remedied.  If something dies, it can be replaced automatically either by Kubernetes or an autoscaling group.  This is declarative infrastructure; we declare exactly how the environment should be configured and we enforce that definition rather than hoping that everything is configured properly.
  • Gene Kim (author of The Phoenix Project) used to say that one indicator of high-performing operations teams was that they could build representative test environments at will.  When we have declarative infrastructure, we can not only build representative test environments of our current infrastructure, but using revision control history, we can build environments that represent anything we’ve built in the past.  Tricky bug from the past that you’re having trouble reproducing?  Build what the infrastructure looked like at that time.  No problem.
  • When we can build like this, security is always built in.  We never have to cut corners because some big customer is demanding that we build their installation by X date.  The security permissions are always consistent.  The logging audit logs are always sent to the correct place.  The security agents are always deployed correctly on the correct hosts.
  • Just like the auditability of those environments, because all changes to these configurations are committed to source control, there is a complete audit log of all the changes, as well as who made those changes.  If you’re using Git, there is a cryptographic marker.
 

100% Automated Testing


You’re probably thinking: there is no way he means there should be no manual testing steps between code commit and deployment in production.
 
There should be no manual testing steps between code commit and deployment in production.

That does not mean that no one is allowed to test anything manually.  It only means that manual testing cannot block the path to production.  If something isn’t marked as ready for deployment until some manual testing is done, then this secret’s power is broken.

This also doesn’t mean that there is no place for manual testing.  Exploratory testing is definitely recommended.  Figuring out what to test and how to best test it all can be done manually.  Once that is determined however, the software needs to be tested via automation.  
  • How much testing is up to you.  As explained in the book Continuous Delivery by Humble & Farley, the more testing you do, the more confidence you will have in what you deploy.  You can do far, far more high-quality testing if it is fully automated then you could possibly hope for with an entire army of manual testers.
  • You do not have to have 100% test coverage (like most things it’s subject to the Pareto Principle) but you can achieve far greater test coverage with automated testing.
  • If everything is automated, then it will be less necessary to cut corners when doing an “emergency deploy”.  We’ve all seen scenarios where testing is cut in an emergency because it takes too long.  Don’t become a victim of Hadfield’s Law - “there is no problem so bad that it can’t be made worse.”
  • Automated testing is consistent.  If you have flapping tests, they need to be fixed.  Computers never have a bad day.  They never go to bed late or have a fight with their spouse.  They are repeatable and reliable at performing tests, day in and day out.
  • Automated tests will give you faster testing cycles and therefore faster feedback.  Continuous Delivery points out that a developer should wait no longer than about 10-15 minutes for their unit tests to complete so they know if they can proceed.  This fast feedback  makes mistakes far cheaper and easier to fix in pre-prod  than code that has been deployed to production.
  • Automated testing brings increased quality.  In Test Driven Development (TDD) the tests are written first and the code second.  When the tests all pass, we know that the code does exactly what it is supposed to do.  If we have to wait for the manual QA process to complete, then we are only guessing that the code does what it is supposed to do.   We want developers, not guessers.
  • When the tests pass in all environments, the code is ready to be deployed.  There is no discussion to be had.  If the tests are all green, then green means go.
  • The Product Org will be happier because the product will be delivered faster and they will know there will be no known escaped defects, because those potential defects were tested to make sure they passed.
  • The automated testing will enhance collaboration between teams because the test can enforce contracts that are defined between different teams (and likely API endpoints).  If each team is in compliance within a loosely coupled architecture, then each team can move as quickly and efficiently as possible. 

These “secrets” are all practices done by high performing software teams and organizations.  While they are sometimes intuitive, and sometimes not, there is one reason  why they are practiced: because the benefits are immense and collectively set organizations that know them apart from their lower-performing competition.

There are common themes that run throughout about security, repeatability, and auditing; these are the building blocks of what make these teams high performing.  Any good developer knows that the value they bring is not in writing code, it is in solving customer problems.  Any good operations engineer knows that the value they bring is not in being able to configure things that are hard to configure, it is in enabling customers to have access to high quality, reliable software.

What secrets do you practice?


 
DevOps Patterns for Private Equity is available now.  Get your copy.
Email
LinkedIn
Website
Don't miss what's next. Subscribe to DevOps & Private Equity:
← Newer [DevOps & Private Equity] Cross-functional teams are NOT for PE portcos Older → [DevOps & Private Equity] Respect for Production in the cloud
Powered by Buttondown, the easiest way to start and grow your newsletter.