Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active April 7, 2023 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfarcic/853635e2c8ca52e8f1be2d9c6a6d4d68 to your computer and use it in GitHub Desktop.
Save vfarcic/853635e2c8ca52e8f1be2d9c6a6d4d68 to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/vfarcic/853635e2c8ca52e8f1be2d9c6a6d4d68
#######################################################################
# What Is Mutual TLS (mTLS), Why Do We Need It, And How Do We Get It? #
# https://youtu.be/b38k2GiLDdc #
#######################################################################
# Additional Info:
# - What Is Kubernetes Ingress And How Does It Work?: https://youtu.be/HqTEHVlQpwY
#########
# Setup #
#########
# Create a Kubernetes cluster (any should do).
git clone https://github.com/vfarcic/mtls-demo
cd mtls-demo
kubectl apply --filename namespace.yaml
# Install `linkerd` CLI by following the instructions in
# https://linkerd.io/2.12/getting-started/#step-1-install-the-cli
linkerd version
# Please make sure that the version is 2.12.x or higher.
linkerd check --pre
linkerd install --crds | kubectl apply --filename -
linkerd install | kubectl apply --filename -
linkerd viz install | kubectl apply --filename -
#####################################
# Applying mTLS With Service Meshes #
#####################################
kubectl --namespace demo apply --kustomize kustomize/base
kubectl --namespace demo run other-app --image alpine \
--restart Never --rm --stdin --tty -- sh
apk add -U curl
curl "http://silly-demo:8080"
exit
kubectl --namespace demo delete --kustomize kustomize/base
cat namespace-meshed.yaml
kubectl apply --filename namespace-meshed.yaml
kubectl --namespace demo apply --kustomize kustomize/base
kubectl --namespace demo get pods
kubectl --namespace demo run other-app --image alpine \
-- sleep 100000
# Execute in a separate terminal tab.
linkerd viz edges pod --namespace demo
# Execute in a separate terminal tab.
# Press `Ctrl+C` to stop the `viz` command.
# Execute in a separate terminal tab.
linkerd viz tap pod --namespace demo
kubectl --namespace demo exec --stdin --tty other-app \
--container other-app -- sh
apk add -U curl
curl "http://silly-demo:8080"
###########
# Destroy #
###########
exit
# Press `Ctrl+C` in the second terminal tab to stop the `viz`
# command.
# Reset of destroy the cluster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment