GitOps - A Security Perspective (Part 1)
Tags: gitops, kubernetes, security, cicd
Published: 2020-04-13 13:03:45

---
title: GitOps - A Security Perspective (Part 1)
published: true
description: Part one of a blog post series covering GitOps and Kubernetes security.
tags: gitops, kubernetes, security, cicd
canonical_url: https://blog.alcide.io/gitops-a-security-perspective
---

![https://p78.f0.n0.cdn.getcloudapp.com/items/yAu2864l/Image%202020-04-13%20at%208.29.49%20AM.png?v=a8a200d5ca1a59379349e629f97e44a1](https://p78.f0.n0.cdn.getcloudapp.com/items/yAu2864l/Image%202020-04-13%20at%208.29.49%20AM.png?v=a8a200d5ca1a59379349e629f97e44a1)

[GitOps](https://www.gitops.tech/) is a paradigm that puts Git at the heart of building and operating cloud native applications by using Git as the single source of truth and empowers developers to perform what used to fall under IT operations. This post is part a blog post series covering GitOps and Kubernetes security.

# Kubernetes - A GitOps Companion

[Kubernetes](https://www.alcide.io/kubernetes-security), as the new application server, leverages a “declarative” approach when it comes to building cloud native application, which means that application configuration is guaranteed by a set of facts instead of by a set of instructions. With application’s declarations versioned in Git, we have a single source of truth, our apps can be easily deployed and rolled back to and from Kubernetes, and when disaster strikes, your cluster’s infrastructure can also be reproduced.

With Git at the center of the delivery pipelines, developers can make pull requests to accelerate and simplify application deployments and operations tasks to Kubernetes.

![gitops-flowchart-advisor](https://p78.f0.n0.cdn.getcloudapp.com/items/qGudAXDm/Image%202020-04-13%20at%208.31.54%20AM.png?v=a5b9b5f0fa77fdc11cfcabdb6f492de6)

# Is GitOps right for you?

The fresh approach that GitOps + Kubernetes brings into the application delivery lifecycle is undeniably different, increasing engineering velocity, as well as simplifies building the CI+CD pipelines themselves. The question of whether a GitOps ‘Pull’ approach is a better fit than ‘Push’ approach is really a matter of engineering & operational culture of an organization, as well as almost a theological question of whether engineering are accountable for security and what visibility into this application server blackbox, security teams require.

# GitOps & Security

1. GitOps changes are synched into the cluster only through the cluster git repository users. The repository is secured at the same level of the git user accounts. A compromised user account in with permissions to push into the cluster git repo can introduce changes that will result in a data breach, service disruption or anything in between. There must be additional guardrails that GitOps infrastructure must implement in the form of whitelisting in order to have a cluster side guardrails.

2. GitOps tools like [Flux](https://www.weave.works/oss/flux/), [ArgoCD](https://argoproj.github.io/argo-cd/) and alike are practically running with cluster god permissions - and are persistent in the cluster. Kubernetes Dashboard, which is considered to be a high risk cluster, is often times removed from the cluster. 
‘Push’ based CD pipelines, such as [Spinnaker](https://www.spinnaker.io/), [Jenkins](https://jenkins.io/) and alike are external to the cluster, invoke on-demand, and introduce automation-driven changes into the cluster.

    ![RBAC GitOps](https://p78.f0.n0.cdn.getcloudapp.com/items/p9u7d8Pb/Image%202020-04-13%20at%208.34.35%20AM.png?v=6f4dfdfe4ccd49f7fa23619cfd35fe3c)

    Example: [Flux RBAC Permission](https://github.com/fluxcd/flux/blob/master/deploy/flux-account.yaml) - Cluster God * * * * *

3. GitOps tools like Flux, ArgoCD and alike require cluster external access, represented as domain names (github.com, bitbucket.org, gitlab.com,..) which means that the [Kubernetes native policies](https://kubernetes.io/docs/concepts/services-networking/network-policies/) are not suitable to implement to segment those highly privileged in-cluster components.

4. Application secrets in a GitOps era requires a Kubernetes external secret provider. For example [Hashicorp Vault](https://www.hashicorp.com/products/vault/), [AWS KMS](https://aws.amazon.com/kms/), [Azure Vault](https://azure.microsoft.com/en-us/services/key-vault/) and alike. Alternatively, teams can revert into [Git Secrets](https://git-secret.io/) which means committing secrets into git in their encrypted form, and decrypting the secrets before application consumption.

# Conclusion

[Continuous integration/continuous development (CI/CD) with the Kubernetes ecosystem](https://www.alcide.io/secured-ci-cd-pipeline) does have a variety of tools to choose from and organizations should use the tools that are best suited for their specific use cases and culture. Glueing all the pieces together is not trivial. Integrating security and consuming security insights by various stakeholders is an equally challenging task to achieve. GitOps simplifies this in some aspects, but complicates in other aspects.

Stay tuned for Part 2.

_Join our upcoming webinar on April 22nd: [GitOps Best Practices for Continuous Deployment and Progressive Security](https://webinars.devops.com/gitops-best-practices-for-continuous-deployment-and-progressive-security)._