Skip to content

Commit

Permalink
adding config files for blog post (#334)
Browse files Browse the repository at this point in the history
* adding config files for blog post 

Full configuration files for blog post "Securing Kubernetes applications with AWS App Mesh and cert-manager"

* Update yelb-virtualnode-tls.yaml

removing "enforce: true" from TLS clientPolicy as it is a default

* Update yelb-gw.yaml

removing "enforce: true" from TLS clientPolicy as it is a default

* Update yelb-gw.yaml

using variables to set envoy image and NLB cert arn

* Update README.md

using variables to set envoy image and NLB cert arn
  • Loading branch information
egagala authored Sep 2, 2020
1 parent a7be4f5 commit 7131ef7
Show file tree
Hide file tree
Showing 7 changed files with 849 additions and 0 deletions.
66 changes: 66 additions & 0 deletions blogs/cert-manager-tls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Securing Kubernetes applications with AWS App Mesh and cert-manager

Full configuration files for blog post [Securing Kubernetes applications with AWS App Mesh and cert-manager]()

## 0. Deploy base yelb with App Mesh

`kubectl apply -f yelb-base.yaml`

## 1. Install cert-manager

```
kubectl create ns cert-manager
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--version v0.16.1 \
--set installCRDs=true
```

## 2. Create CA and issue certificates for microservices

```
#generate a private key
openssl genrsa -out ca.key 2048
#create a self signed x.509 CA certificate
openssl req -x509 -new -key ca.key -subj "/CN=App Mesh Examples CA" -days 3650 -out ca.crt
#create TLS secret
kubectl create secret tls ca-key-pair \
--cert=ca.crt \
--key=ca.key \
--namespace=yelb
#create CA issuer
kubectl apply -f ca-issuer.yaml
#create certificate
kubectl apply -f yelb-cert.yaml
```

## 3. Mount certificate to microservice deployment

`kubectl apply -f yelb-deployment-secretMounts.yaml`

## 4. Add TLS configuration to virtual node

`kubectl apply -f yelb-virtualnode-tls.yaml`

## 5. Configure encryption between external LB and App Mesh

Please set `ENVOY_IMAGE` ENV variable to the correct value based on https://docs.aws.amazon.com/app-mesh/latest/userguide/envoy.html

Additionally set `LB_CERT_ARN` ENV variable with your own valid arn.

```
ENVOY_IMAGE="840364872350.dkr.ecr.<region>.amazonaws.com/aws-appmesh-envoy:<version>"
LB_CERT_ARN="arn:aws:acm:<region>:<account-id>:certificate/<cert-id>"
sed -e "s|{{ENVOY_IMAGE}}|${ENVOY_IMAGE}|g" -e "s|{{LB_CERT_ARN}}|${LB_CERT_ARN}|g" yelb-gw.yaml | kubectl apply -f -
```
8 changes: 8 additions & 0 deletions blogs/cert-manager-tls/ca-issuer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: cert-manager.io/v1alpha2
kind: Issuer
metadata:
name: ca-issuer
namespace: yelb
spec:
ca:
secretName: ca-key-pair
Loading

0 comments on commit 7131ef7

Please sign in to comment.