Files
oam/knowledge base/kubernetes/check pods can connect to external dbs.md
2023-11-18 19:48:55 +01:00

879 B

Check Pods can connect to external DBs

Table of contents

  1. TL;DR
  2. Further readings

TL;DR

  1. Get a shell on a test container.

    kubectl run --generator='run-pod/v1' --image 'alpine' -it --rm \
      --limits 'cpu=200m,memory=512Mi' --requests 'cpu=200m,memory=512Mi' \
      ${USER}-mysql-test -- sh
    
  2. Install the utility applications needed for the tests.

    apk --no-cache add 'mysql-client' 'netcat-openbsd''
    
  3. Test basic connectivity to the external service.

    nc -vz -w3 '10.0.2.15' '3306'
    
  4. Test application connectivity.

    mysql --host '10.0.2.15' --port '3306' --user 'root'
    

Further readings