How to Propagate Secrets Everywhere with External Secrets Operator (ESO) and Crossplane

DevOps Toolkit
18 Mar 202420:35

Summary

TLDRThe video discusses managing secrets in a Kubernetes environment, emphasizing the importance of secure and efficient handling. It introduces the use of external Secrets operator for pulling and pushing secrets between different secret managers and clusters. The speaker shares their experience in setting up a control plane cluster and using Crossplane to create new clusters with necessary secrets automatically propagated. The video provides a detailed walkthrough of the process, including the use of policies for access control, and demonstrates how to handle secrets for both cluster creation and database access, ensuring security and transparency for end-users.

Takeaways

  • 🔐 The video discusses the management of secrets in a Kubernetes environment, emphasizing the importance of secure and efficient handling.
  • 📚 The speaker aims to answer less commonly asked but important questions about making secrets easy for users, propagation, generation, and safe usage across different locations.
  • 🖥️ The speaker manages multiple resources like clusters, applications, and databases, some of which generate or consume secrets, and highlights the challenges in handling them.
  • 🔄 The issue with manually added secrets in secret stores and Kubernetes secrets that are not stored in these stores is addressed as a problematic situation.
  • 🤖 The use of external Secrets operator is mentioned as a tool to pull and push secrets from and to secret managers like Google Secret Manager, AWS Secret Manager, and Azure Key Vault.
  • 🚀 The speaker's requirement for a control plane cluster is to have secrets pulled from a manager and automatically loaded with necessary credentials and secrets.
  • 🔄 The concept of copying secrets from one place to another is discussed, with a preference for pushing and pulling secrets to and from a secret manager for safety.
  • 🛠️ The video provides a solution using Crossplane and external Secrets operator to automate the process of creating clusters pre-loaded with necessary secrets and operators.
  • 🔑 The importance of policies in ensuring that only authorized users can create cluster claims and have access to certain secrets is emphasized for security.
  • 📈 The video includes a practical demonstration of the setup using YAML files and the Crossplane trace command to show the creation and management of resources and secrets.
  • 🎯 The ultimate goal is to make the handling of secrets transparent and effortless for end users, allowing them to focus on what matters while maintaining security and safety.

Q & A

  • What is the main focus of the video regarding Secrets management?

    -The main focus of the video is to discuss and address less commonly asked but important questions about managing Secrets in a way that makes them easy and irrelevant to users, propagates them safely, and allows their generation and use in different places without exposure.

  • What problem does the speaker face with managing multiple resources and Secrets?

    -The speaker faces the problem of managing a variety of resources like clusters, applications, and databases that generate or consume Secrets. Some Secrets are manually added to secret stores, while others are generated as Kubernetes secrets and not stored in any secret manager, leading to a potentially insecure situation.

  • How does the speaker propose to solve the problem of making Secrets management automatic and less burdensome?

    -The speaker proposes using tools like the external Secrets operator to pull and push secrets from and to secret managers, and automating the process of creating clusters pre-loaded with necessary Secrets and credentials, making the whole process transparent and seamless for end users.

  • What is the role of the external Secrets operator in the speaker's solution?

    -The external Secrets operator plays a crucial role by enabling the pulling of secrets from a secret manager to a Kubernetes cluster and pushing secrets to a secret manager from one place to another. It helps in authenticating with the secret manager and facilitates the secure propagation of Secrets.

  • How does the speaker handle the creation and management of Secrets for a new database in one place and an application consuming that database in another?

    -The speaker uses a combination of Crossplane and external Secrets operator to create a secret in the control plane cluster, push it to the secret manager, and then pull it into the cluster where the application is running. This ensures that the secret is available where it is needed without being manually copied or moved.

  • What is the speaker's approach to ensuring security and transparency in Secrets management?

    -The speaker emphasizes the importance of keeping Secrets secure by storing them in a secret manager and using tools like the external Secrets operator to manage them. The goal is to make the process transparent and invisible to end users, allowing them to focus on what matters to them while ensuring their safety and security.

  • How does the speaker demonstrate the application of the discussed concepts in a practical scenario?

    -The speaker provides a detailed walkthrough of creating a Kubernetes cluster with Crossplane, managing AWS credentials, and using the external Secrets operator to pull and push secrets as needed. They also show how to handle the creation and propagation of secrets for a database and an application running in different clusters.

  • What is the significance of the 'creds' entry in the cluster claim?

    -The 'creds' entry in the cluster claim is significant because it instructs Crossplane to take the AWS credentials secret and put it into the Crossplane system namespace. This allows the new cluster created to have access to the necessary credentials for interacting with external services.

  • How does the speaker address the eventual consistency in the context of Secrets management?

    -The speaker acknowledges the concept of eventual consistency, especially when resources are being created and managed across different clusters. They explain that some resources might initially show errors, but eventually, everything will become consistent once all the resources are up and running.

  • What is the role of policies in ensuring the security of the entire setup?

    -Policies play a crucial role in defining who can do what within the system, specifically who can create cluster claims and what values are allowed. By setting up appropriate policies, the speaker ensures that the creation and management of clusters and Secrets are restricted to authorized users, enhancing the overall security of the setup.

  • What is the speaker's final takeaway from the video?

    -The speaker's final takeaway is the demonstration of how Crossplane, external Secrets, and other tools can be combined to effectively manage Secrets and resources in a way that is secure, automated, and transparent to end users. The speaker shows that with the right tools and configurations, complex tasks like propagating secrets between clusters can be made simple and seamless.

Outlines

00:00

🔐 Introduction to Secrets Management

The paragraph introduces the topic of secrets management and outlines the challenges faced when dealing with secrets in a multi-resource environment. It highlights the need for making secrets easy and irrelevant to users, propagating them securely, and generating and using them in different locations without exposing them. The speaker shares their experience in managing resources like clusters and databases that generate or consume secrets and the issues they encountered with manual secret management and the use of secret stores like Google Secret Manager, AWS Secret Manager, and Azure Key Vault. The aim is to find a solution that doesn't complicate life and makes the process as seamless as possible.

05:01

🤖 The Role of External Secrets Operator

This paragraph discusses the role of the External Secrets Operator in solving some of the problems faced with secrets management. It explains how the operator can pull secrets from various secret managers and also push secrets to them. The speaker shares their need for a control plane cluster that can create, manage, and remove Kubernetes clusters with the required secrets for external services, such as container image registries. The challenge is to have these secrets automatically available from the start and not require multiple steps or manual intervention, aiming for a seamless and magical experience for users.

10:03

🚀 Streamlining Secret Propagation and Access

The speaker presents a solution to the challenges discussed earlier by using Crossplane and the External Secrets Operator. They demonstrate how to deal with secrets without causing discomfort to users. The process involves using a cluster claim to create a Kubernetes cluster in AWS with all the necessary secrets for operation. The AWS credentials secret is manually created in the control plane cluster and used by both Crossplane and the External Secrets Operator. The operator is configured to pull secrets from the secret manager, and the end-user's experience is simplified by allowing them to write a few lines of YAML and interact with the Kubernetes API. The speaker emphasizes the importance of eventual consistency in this process and the safety of secrets stored in the secret manager.

15:05

🔄 Moving Secrets Between Clusters

The paragraph delves into the specifics of moving secrets between clusters, particularly for databases that may be running in a different location from the applications that consume them. The speaker explains the process of creating a database using Crossplane, which generates a Kubernetes secret with authentication details in the control plane cluster. To make this secret available to the application running in a different cluster, the speaker describes a composition that pushes the secret to the secret manager and then pulls it into the target cluster. This ensures that the secret is not just copied but managed and propagated securely.

20:06

🎉 Conclusion and Demonstration

The speaker concludes by summarizing the steps taken to manage secrets effectively using Crossplane, External Secrets, and other tools. They demonstrate the creation of an AWS RDS database server and the associated Kubernetes secrets through a composite claim. The process involves creating a root password secret in the control plane cluster, pushing it to the secret manager, and then pulling it into the target cluster where the application runs. The speaker confirms the successful creation and synchronization of secrets by listing them in the respective namespaces and emphasizes the ease and security of this approach for both developers and end-users.

Mindmap

Keywords

💡Secrets

In the context of the video, 'Secrets' refers to sensitive information such as passwords, API keys, and credentials that are used to authenticate and authorize access to various resources and services. The video discusses the management of these secrets in a way that ensures security without burdening the end users with complex details. An example from the script is the use of a Google secret manager or AWS secret manager to store these secrets.

💡External Secrets Operator

The 'External Secrets Operator' is a tool mentioned in the video that facilitates the management of secrets by pulling them from one place and pushing them to another. It simplifies the process of using secrets in different environments by abstracting away the complexity of direct secret management. In the video, the operator is used to pull secrets from a secret manager and push them to a Kubernetes cluster, as illustrated when discussing the propagation of secrets for container image registry authentication.

💡Kubernetes

Kubernetes, often abbreviated as K8s, is an open-source container orchestration system for automating the deployment, scaling, and management of containerized applications. The video discusses the use of Kubernetes secrets, which are sensitive information stored in Kubernetes clusters, and the challenges associated with managing these secrets across different clusters. The video provides an example of how Kubernetes secrets can be managed using the External Secrets Operator.

💡Crossplane

Crossplane is an open-source cloud infrastructure management tool that simplifies the deployment and management of cloud resources. In the video, Crossplane is used to create and manage Kubernetes clusters and other resources, and it plays a crucial role in the automation of secret management. The video demonstrates how Crossplane can be used to propagate secrets from the control plane to different clusters, ensuring that the necessary credentials are available where they are needed.

💡Control Plane Cluster

A 'Control Plane Cluster' refers to the central management cluster from which other Kubernetes clusters are created, managed, and removed. In the context of the video, the control plane cluster is where the initial setup and configuration take place, including the management of secrets. It serves as the foundation for the creation of other clusters and the propagation of secrets to them, as shown when the video discusses the automatic creation of secrets in new clusters from the control plane.

💡Secret Propagation

Secret Propagation is the process of moving secrets from one location to another within a system or between systems securely. In the video, this concept is crucial for ensuring that the necessary secrets are available in the appropriate clusters without exposing them. The video provides examples of how secrets can be propagated using the External Secrets Operator, which pulls and pushes secrets between the control plane and other clusters.

💡Container Image Registry

A 'Container Image Registry' is a storage repository that holds container images, which are the packaged applications or services that can be run in a containerized environment. The video discusses the need for credentials to pull or push container images to or from a registry. These credentials are stored as secrets, and the video explains how they can be managed and propagated to ensure secure access to the container image registry.

💡Database Authentication

Database Authentication refers to the process of verifying the identity of a user or an application that is trying to access a database. In the video, this concept is relevant when discussing the creation of secrets for database access. The video explains how secrets containing database authentication details can be created, propagated, and used in different clusters, ensuring that applications can securely connect to databases.

💡Terraform

Terraform is a software tool for infrastructure as code (IaC) that enables the creation, modification, and versioning of infrastructure in a way that is consistent and reproducible. In the video, Terraform is mentioned as one of the tools that can be run from the control plane to manage resources. Although not the primary focus, Terraform's role in infrastructure management is analogous to the management of secrets discussed in the video, emphasizing the importance of automation and control over infrastructure and secrets.

💡Open Function

Open Function is a platform mentioned in the video that is used for building and deploying containerized applications. It requires credentials stored in a Kubernetes secret to function correctly. These credentials are related to the management of secrets discussed in the video, as they need to be securely stored and propagated to where they are needed. The video demonstrates how Open Function integrates with the secret management process to ensure that applications can securely access the necessary resources.

💡Eventual Consistency

Eventual Consistency is a concept in distributed systems that ensures all nodes or systems will receive the same data and that all operations will be processed in the same order, but there might be a delay. In the context of the video, this concept is relevant when discussing the propagation of secrets and the time it takes for changes to be reflected across all systems. The video touches on eventual consistency when explaining the process of creating and managing secrets across different clusters, emphasizing that while there might be a delay, the system will eventually reach a consistent state.

Highlights

The speaker aims to address less commonly asked but important questions about managing secrets in a secure and user-friendly manner.

The challenge of making secrets easy and irrelevant to users is discussed, focusing on user experience and security.

The issue of propagating secrets without exposure is explored, emphasizing the balance between accessibility and protection.

The generation and safe usage of secrets in different locations is a key topic, highlighting the complexity of modern IT infrastructure.

The speaker shares personal experiences with managing resources, clusters, applications, and databases that generate or consume secrets.

The use of secret stores like Google Secret Manager, AWS Secret Manager, and Azure Key Vault is mentioned for managing secrets.

The speaker discusses the limitations of Kubernetes secrets not being stored in secret stores, pointing out a potential security risk.

The external Secrets operator is introduced as a tool to pull and push secrets between different secret managers.

The speaker's need for a control plane cluster that can create, manage, and remove Kubernetes clusters from a central point is explained.

The requirement for clusters to have secrets pulled from a manager upon creation for interaction with outside services is detailed.

The speaker emphasizes the desire for a streamlined process where clusters are pre-loaded with necessary credentials and secrets.

The concept of moving secrets between clusters is discussed, with a preference for copying or pushing secrets to secret managers instead.

The goal of making security transparent and effortless for users is articulated, aiming to create a 'magic'般的 experience.

The speaker presents a solution involving Crossplane and external Secrets operator to manage AWS credentials and create Kubernetes clusters.

The process of copying the AWS credentials secret into new clusters and the use of the creds entry in Crossplane compositions are explained.

The importance of policies in ensuring secure access and usage of secrets is highlighted, discussing CNO policies and their role.

The speaker demonstrates the application of the discussed concepts through a practical example involving a new Kubernetes cluster creation.

The use of external Secrets operator for pulling secrets into a cluster and its integration with Crossplane is showcased.

The speaker addresses the eventual consistency of Kubernetes resources and how it relates to the secret management process.

A comprehensive example involving the creation of an AWS RDS database server and the propagation of its secrets to another cluster is provided.

The speaker illustrates the process of pushing and pulling secrets between secret managers and clusters for a database server use case.

The end goal of creating a secure yet transparent secret management experience for users is reiterated, emphasizing user safety and simplicity.

Transcripts

play00:00

[Music]

play00:06

today I want to talk about Secrets but

play00:08

don't go away don't go away just yet I

play00:11

know that for many Secrets is either

play00:14

boring or you think you already know

play00:17

everything there is to know about

play00:18

managing Secrets I will not talk about

play00:22

obvious secret stuff instead I want to

play00:24

try to answer some less often asked yet

play00:28

important questions how do we make

play00:30

Secrets easy and irrelevant to users how

play00:34

do we propagate Secrets without making

play00:36

them exposed how do we generate secrets

play00:40

in one place but use them in another

play00:44

safely and a few others today's video

play00:47

will be different than what you might

play00:48

expect from Secrets today I want to

play00:51

explore and solve a few problems I was

play00:54

facing not long ago and that I believe I

play00:58

solved without making anyone suffer let

play01:03

me explain the problem before I show you

play01:05

a possible

play01:08

solution I tend to manage a number of

play01:11

resources there are clusters

play01:13

applications databases and so on and so

play01:15

forth most of those generate or consume

play01:19

Secrets some of them do both some

play01:22

secrets were added manually to a Secret

play01:23

store like a Google secret manager AWS

play01:26

secret manager Azure key Vault or

play01:28

whatever else you you are using or I'm

play01:31

using others however are generated as

play01:34

kubernetes secrets and not stored in any

play01:38

of those secret stores which by itself

play01:41

is a bad situation which I will explain

play01:44

in a moment so far you probably do not

play01:46

see a problem you might be inclined to

play01:48

say that a tool like external Secrets

play01:50

operator can solve those issues it can

play01:54

pull secrets from almost any secret

play01:56

manager if you're already using it you

play01:59

might even be aware that it can also

play02:01

push secrets to a secret manager choice

play02:05

if you're not familiar with external

play02:06

secrets you might want to watch that

play02:08

video just don't do it right now finish

play02:11

this one first if that's what you're

play02:13

thinking you're right external Secrets

play02:15

operator or any other similar tool

play02:18

solves some of my problems but not all

play02:22

let me explain what I need I have a

play02:24

control plane cluster in my case that's

play02:26

cross plane and in yours that might be

play02:28

something else it's could be a simple

play02:31

server from which you run terraform or a

play02:33

pipeline or anything else from where you

play02:35

do stuff it does not matter for now what

play02:39

does matter is that kubernetes clusters

play02:41

are created managed and removed from

play02:43

that control plane now those clusters

play02:45

need to have a number of secrets that

play02:48

enable them to interact with outside

play02:50

Services a good example would be

play02:52

credentials that must be used to pull or

play02:54

even push images from or to a container

play02:58

image registry almost almost every

play03:00

cluster needs some secrets to operate

play03:02

correctly now those Secrets should be

play03:04

pulled from whichever Secrets manager I

play03:07

might be using and that means that they

play03:09

all have to have external Secrets

play03:12

operator or whichever other similar tool

play03:15

we might be using however that operator

play03:18

needs a secret with authentication so

play03:21

that it can fetch secrets from the

play03:23

secrets manager to be honest I know that

play03:25

there are many many ways to accomplish

play03:28

all that but to tend to complicate My

play03:30

Life by treating all those requirements

play03:32

as Baseline requirements as table Stakes

play03:35

when I do create a cluster all those

play03:37

need to be there from the start and I

play03:41

don't want to have to perform many steps

play03:43

to get them ideally I should say create

play03:46

a cluster and apart from a cluster being

play03:49

created it should come pre-loaded with

play03:51

the external Secrets operator

play03:52

credentials it needs and secrets pulled

play03:56

I don't want to work to get those they

play03:58

just need to get their automatically

play04:00

there's more though sometimes I will set

play04:03

up a new database in one place but run

play04:05

an application that consumes that

play04:07

database in another I might for example

play04:10

instruct the control plane to create and

play04:12

manage a database and that will among

play04:15

other things result in a secret with

play04:17

database authentication being created in

play04:19

the control plane cluster I don't need

play04:22

that secret there I need it somewhere

play04:25

else I need it in the cluster where the

play04:28

application that consumes assumes the

play04:30

database is running hence that secret

play04:32

needs to be moved from one place to

play04:34

another actually that's not correct it

play04:37

should not be moved but rather copied

play04:40

however I cannot just copy the secret

play04:42

that would be silly since I'm supposed

play04:44

to keep secrets in the secret manager

play04:46

hence I need to push that secret to the

play04:49

secret manager from one place and pull

play04:52

it from the secret manager to another

play04:55

there's still more though I don't want

play04:58

those things to be a burden to others

play05:00

creating and managing databases or

play05:03

applications or whatever they're

play05:04

managing I want all that to be

play05:06

transparent no invisible I want people

play05:09

to be secure yet not to have to learn

play05:13

all the details or worry about those

play05:15

things it should be like magic people

play05:18

should be in control of things that

play05:20

matter to them while those that don't

play05:22

should just happen Secrets or even

play05:25

Security in general fall into the I do

play05:28

not care that I am safe category

play05:32

normally I have quite a few other

play05:33

requirements but those I discussed so

play05:36

far are enough to give you an idea what

play05:38

I'm trying to accomplish that was enough

play05:41

talk let me show you how I solved those

play05:43

issues let me show you how to deal with

play05:46

Secrets without making anyone

play05:51

suffer before we proceed I should tell

play05:54

you that all the commands I will execute

play05:56

in this video are available in aist and

play05:58

the link to it is in the description

play06:01

please use it if you would like to

play06:02

reproduce what I'm showcasing right now

play06:05

my cube cutle is pointing to the control

play06:07

plane cluster over there if you take a

play06:09

look at the crossplane system Nam space

play06:13

we can see that aw crets is available I

play06:16

created that secret manually and

play06:18

hopefully hopefully that's the only

play06:21

secret I will manage myself that secret

play06:24

contains AWS credentials which for

play06:27

example are used by crossplane to

play06:28

communicate with my AWS account to

play06:30

create kubernetes clusters databases and

play06:32

whatever else I need at the same time

play06:35

that secret is also used by external

play06:37

Secrets operator to pull Secrets I

play06:40

instructed to pull by the way I made an

play06:43

assumption that you're familiar with

play06:44

crossplane if you're not please watch

play06:47

those videos or even better watch the

play06:50

crossplay tutorial I published uh as a

play06:52

set of videos short file ago the link to

play06:55

the playlist is in the description

play06:57

alternatively you can explore the

play06:59

composition yourself the link to the

play07:01

repo is in the description as well the

play07:03

important note within the context of

play07:05

today's subject is that I need that

play07:07

secret to be available in clusters I

play07:10

will create from this control plane so

play07:12

let's take a look at one example and

play07:14

this is the part that makes everything

play07:16

simple for the end users it is a cluster

play07:18

claim that creates everything required

play07:20

to run a kubernetes cluster in AWS if

play07:22

you followed my work you already saw a

play07:24

variation of such crossplay composition

play07:26

so I will not go into details the

play07:28

interesting part is the creds entry that

play07:31

font tells crossplane to take the AWS

play07:33

creds secret and put it into the

play07:36

crossplane system namespace that secret

play07:38

in that cluster should contain the creds

play07:41

access key ID and secret access key keys

play07:45

as a result crossplane will create a

play07:47

cluster and everything it needs and it

play07:49

will copy the AWS cret secret into that

play07:52

new cluster now to be completely clear

play07:56

that's not the best way to propagate

play07:58

secrets from one place to another a

play08:00

better way would be to use external

play08:02

Secrets operator and instruct it to pull

play08:04

a secret from a secret manager however

play08:08

to do that we need external secrets to

play08:10

be able to authenticate with the secrets

play08:12

manager and that's the primary purpose

play08:14

of coping AWS creds secret an important

play08:18

note is that the end user has freedom to

play08:21

choose which secret to copy to which

play08:23

namespace to place it and which keys to

play08:26

include on the other hand the end user

play08:28

does not need to worry about the details

play08:30

there's no need to know how it was done

play08:33

and what's the magic behind the process

play08:35

further on we have the open function

play08:38

field which installs open function in

play08:40

that cluster that one is not directly

play08:42

related to Secrets however among other

play08:45

things open function builds container

play08:47

images and stores them in a registry for

play08:49

that to work it needs credentials stored

play08:52

in a kubernetes secret by the way if

play08:54

you're not familiar with open function

play08:57

please check out that video uh since I

play09:00

already explained it over there I will

play09:01

not go into details of how it works and

play09:04

what it does in in this one in this

play09:06

video to accommodate the need for a

play09:09

secret with container registry

play09:10

authentication as well as other secrets

play09:13

we might need that is the external

play09:15

Secrets section in it we have the

play09:18

enabled field that will ensure that

play09:20

external Secrets operator is deployed to

play09:22

the cluster and the store which will

play09:24

create cluster Secrets store resource

play09:28

that's the one that needs a secret that

play09:30

allows it to connect to the secret

play09:31

manager that secret is retrieved from

play09:34

the aw crets we explored earlier and all

play09:36

we have to do is specify the keys

play09:40

finally with external Secrets operator

play09:42

fully operational and capable of

play09:44

fetching secrets from the secrets

play09:45

manager we are listing all the secrets

play09:48

we would like to pull into that cluster

play09:51

in this specific case there is one that

play09:54

provides authentication to The Container

play09:56

image registry needed for oper function

play09:59

now now you might be thinking that the

play10:00

whole setup is not secure and you would

play10:03

be right secrets are stored safely in

play10:05

the secrets manager but anyone could

play10:08

create a cluster with any or all of the

play10:11

secrets that's where policies would come

play10:13

in typically I would set up CNO policies

play10:15

that would define who can do what and

play10:18

more specifically who can create those

play10:20

cluster claims and which values are

play10:22

allowed that combined with the fact that

play10:24

secrets are safely pulled from a Secrets

play10:27

manager makes it pretty safe except the

play10:29

fact that kubernetes Secrets themselves

play10:31

are not always safe but that would be a

play10:33

subject for a separate video the good

play10:36

news is that the end users do not need

play10:39

to worry about any of the things we

play10:41

discussed all they have to do is write

play10:43

those 30s something lines of yam and

play10:45

send it to the kubernetes API so let's

play10:48

do just that now we can observe what's

play10:51

happening with the crossplane trace

play10:53

command quite a few resources were

play10:55

created in the control plane cluster

play10:57

some of them will create and manage a WS

play10:59

resources others will create stuff in

play11:01

the control plane cluster while some

play11:03

will set up things in the new cluster

play11:06

once it's operational you will notice

play11:08

that quite a few resources are having

play11:09

errors that's okay some of them like for

play11:13

example Nam spaces cannot be created yet

play11:15

since the cluster where they should be

play11:17

applied is not yet operational

play11:19

everything will be eventually consistent

play11:22

and while waiting for that to happen we

play11:24

can focus on the few of those resources

play11:27

related to the secrets we discussed by

play11:29

the way I explored eventual consistency

play11:31

both from the theoretical and from the

play11:33

Practical perspectives in those videos

play11:36

over there uh so please check them out

play11:38

if you would like to understand better

play11:40

what I meant by uh all this by eventual

play11:44

consistency we have the ATM cluster

play11:47

credits resources that is copying the

play11:49

hyperscaler credentials from the control

play11:51

plane cluster to the new cluster that's

play11:53

the one external Secrets needs to

play11:55

authenticate with the secrets manager

play11:58

which in my case is in AWS then we have

play12:01

a cluster Secret store that will create

play12:05

external Secret store that uses those

play12:07

credentials finally there is the push

play12:09

secret that will be pulled from the

play12:12

secrets manager and which will be used

play12:14

by open function to push those images

play12:17

that's it that was yet another

play12:19

explanation that matters to you the

play12:21

person that builds who builds services

play12:24

like the one we are exploring today but

play12:26

not to the end users they do not need to

play12:29

care yet they will be safe all that's

play12:32

left to do is to wait until all the

play12:34

resources are up and running so let's

play12:37

fast forward and Trace the claim one

play12:40

more time there might be a problem with

play12:41

open function it is still in creating

play12:43

state or to be more precise crossplay

play12:46

things that it is creating but it's

play12:47

probably up and running it's a massive

play12:49

massive Helm chart that takes ages to

play12:51

deploy as and it's probably timing out I

play12:54

I'll fix that later it's that's not

play12:57

relevant for this story what does matter

play12:59

is that we can now retrieve Cube config

play13:03

and retrieve secrets from the crossplane

play13:06

system namespace it's there the AWS cred

play13:10

secret was automatically created in this

play13:12

new cluster we can also list external

play13:14

Secret store and observe that that it

play13:19

was created correctly the fact that the

play13:21

status is valid means that it was able

play13:24

to connect to the secrets manager in AWS

play13:27

in this case we can also list external

play13:29

Secrets resources and observe that push

play13:33

secret was synced that means that it

play13:35

succeeded in pulling the register secret

play13:38

from the secret manager we can confirm

play13:40

that as well by retrieving kubernetes

play13:42

secrets from the production Nam space

play13:44

the push secret is there that's the one

play13:47

that contains the authentication to The

play13:49

Container image registry open function

play13:51

needs what did we do let me paint it for

play13:55

you let me show you a diagram of what we

play13:57

did the control plane cluster contained

play13:59

crossplane and a secret with the AWS

play14:02

authentication from there on we applied

play14:04

a crossplane composite claim that

play14:06

created a new kubernetes cluster in my

play14:08

case eks with everything that it

play14:12

requires the secret from the control

play14:14

plane was copied to the new cluster and

play14:15

external Secrets operator was installed

play14:18

and configured using that secret to

play14:20

communicate with the aw Secrets manager

play14:23

finally external Secrets operator pulled

play14:26

the secret with credentials from the

play14:28

container image registry which will be

play14:30

used by open function that was also

play14:33

installed and configured inside that new

play14:36

cluster but here's a big part that's not

play14:41

enough I have a potentially more

play14:44

interesting example to

play14:47

demonstrate databases are special they

play14:51

often do not run in the same place where

play14:53

applications are running for example I

play14:56

might have an awsrds database and then

play14:58

applic running in a kubernetes cluster

play15:00

if RDS is created with crossplane

play15:02

crossplane will create a kubernetes

play15:05

secret with the authentication details

play15:07

however that secret will be created in

play15:10

the control plane cluster the one where

play15:12

cross plane is running while the

play15:13

application that should use it might be

play15:15

running in a different cluster that

play15:17

means that we might need to safely

play15:19

propagate the secret from one cluster to

play15:22

another ideally we should not just copy

play15:25

the secret but push it to the secrets

play15:26

manager and pull it from there wherever

play15:29

we need it that's exactly what we will

play15:31

do next and I already prepared a

play15:33

composition that will do just that so

play15:36

let's take a look at the Manifest that

play15:38

will claim it that manifest will create

play15:40

a poql server and everything else needed

play15:44

for it to run in AWS a database inside

play15:48

that server and quite a few other things

play15:51

those are not important right now what

play15:53

matters is the secrets section by the

play15:56

way please let me know through comments

play15:57

in this video if it would be interesting

play16:00

to explore database as a service in one

play16:03

of the upcoming videos that claim will

play16:05

create a secret in the control plane

play16:07

cluster the one that runs cross plane

play16:09

but as I already mentioned we need it

play16:11

elsewhere that elsewhere could be the

play16:13

new cluster we created earlier it

play16:15

already contains open function which is

play16:17

a great way to define build and deploy

play16:20

applications which might need to connect

play16:22

to a database hence we need the secret

play16:24

in that other cluster the store name

play16:27

defines the external Secret store that's

play16:29

the one we created earlier when we

play16:31

created the cluster RDS requires a root

play16:34

password so we are fetching it from the

play16:35

aw SEC manager through the pull root

play16:39

password key value that's similar to

play16:41

what we did before the interesting part

play16:43

comes next the push to store parameter

play16:46

tells the composite resource to push

play16:48

that secret it will create in the

play16:50

control plane cluster to the secret

play16:52

manager the van LS external Secrets

play16:55

operator which we are propping here has

play16:58

the capability not only to pull but also

play17:00

to push Secrets further on we are

play17:03

telling the claim to pull the secret

play17:06

from the secret manager into the

play17:08

production name space inside The A Team

play17:11

cluster let's apply the claim and see

play17:13

what happens first I will unset Cube

play17:16

config so add Cube cutle points to the

play17:18

control plane cluster and apply the

play17:21

claim let's see what we got with the

play17:23

cross PL phas command among others we

play17:25

got the secret pull resource that pulls

play17:29

root password from The hyperscalers

play17:31

Secret store then there is the push

play17:34

store resource that pushes DB secret to

play17:36

The Secret store and finally the pull

play17:38

cluster resource that pulls the secret

play17:41

with the creds to the other cluster it

play17:44

will take a while until all the

play17:45

resources available so let's fast

play17:48

forward and Trace the claim again all

play17:51

the resources are available and we can

play17:53

take a look at what we got to begin with

play17:55

there should be the secret with the root

play17:57

password in the control plane cluster

play17:59

since that's the data crossplane itself

play18:02

needs we can see that the external

play18:04

secret was created which in turn created

play18:08

the mightyb kubernetes secret with the

play18:10

password pulled from the Clusters uh not

play18:12

clusters but Secrets manager once the

play18:15

database server was created crossplane

play18:17

created a secret with the IP port

play18:20

username and password that can be used

play18:21

to access the database server since we

play18:23

need that info in the other cluster the

play18:26

one where the application that might use

play18:29

that database should be running the

play18:31

composite resource created the external

play18:33

Secrets push secret which in turn pushed

play18:36

it to the secrets manager we can confirm

play18:39

that's indeed what happened by going to

play18:41

the AWS console and there we go the

play18:43

secret was indeed created finally the

play18:46

secret should be pulled into the other

play18:48

cluster so let's export Cube config

play18:51

again and list all external secrets in

play18:55

the production name space the myb

play18:57

external secret is there and you know

play18:59

what that means right if you L the

play19:01

secrets in the production name space we

play19:04

can see that it was pulled from the

play19:06

secrets manager so what did I do what

play19:08

did we do from the control plane cluster

play19:10

the one with cross plane we created a

play19:13

composite claim that created all the AWS

play19:15

resources required to run uh RDS

play19:18

database server and it created database

play19:21

inside it among other things the server

play19:23

needed a root password so the composite

play19:26

resource created an external Secret

play19:29

which in turn pulled the root password

play19:31

from the aw Secrets manager and used it

play19:34

to create a kubernetes secret once the

play19:37

database was created cross created a

play19:39

secret with the connection info since we

play19:42

needed that info in a secret in a

play19:44

different cluster it also created

play19:46

external Secrets push secret which

play19:49

pushed it to the secrets manager finally

play19:52

it created an external secrets in the

play19:55

cluster where the application should run

play19:57

which in turn pulled the connection info

play20:00

from the secrets manager and created

play20:03

kubernetes secret from there on an

play20:06

application can connect to the database

play20:08

from that cluster by simply mounting the

play20:12

secret that must have been overwhelming

play20:15

but hopefully useful to see what can be

play20:17

done by combining crossplane with

play20:18

external secrets and a few other tools

play20:20

thank you for watching see you in the

play20:22

next one

play20:27

cheers

Rate This

5.0 / 5 (0 votes)

Related Tags
Secret ManagementKubernetes SecurityCrossplane CompositionExternal Secrets OperatorAWS IntegrationDatabase HandlingContainer RegistryAutomationInfrastructure as Code