From 78fd6f40258a2a2595509a31c125e1f2a3f56b35 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 21 Apr 2022 10:07:23 +0200 Subject: [PATCH] Added k8s pod notes to the knowledge base --- ...check a pod can connect to an external db.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 knowledge base/check a pod can connect to an external db.md diff --git a/knowledge base/check a pod can connect to an external db.md b/knowledge base/check a pod can connect to an external db.md new file mode 100644 index 0000000..b87a0bf --- /dev/null +++ b/knowledge base/check a pod can connect to an external db.md @@ -0,0 +1,17 @@ +# Check a Pod can connect to an external DB + +## TL;DR + +```shell +# access a test container +kubectl run --generator=run-pod/v1 --limits 'cpu=200m,memory=512Mi' --requests 'cpu=200m,memory=512Mi' --image alpine ${USER}-mysql-test -it -- sh + +# install programs +apk --no-cache add mysql-client netcat-openbsd + +# test plain connectivity +nc -vz -w3 10.0.2.15 3306 + +# test the client can connect +mysql --host 10.0.2.15 --port 3306 --user root +```