Skip to content

Connect to a pod

Description

To connect to command line interface of a specific pod you have to use kubectl command line tool. This tool allow us to connect to a service to do a lot of things related to the environment of each deployment in the cluster like test connectivity or libraries compatibility.

Requirements

Kubectl command line tool installed and configured. Use the next guide if you don’t.

Procedure

Use the next command to discover all pods for an specific namespace
> kubectl -n <namespace> get pods
NAME READY STATUS RESTARTS AGE
apiv3-554c6bc68d-299xg 1/1 Running 0 5h34m
auth-55fc8fb6f5-dv4km 1/1 Running 0 30h
graph-6598d44947-24fvk 1/1 Running 0 3d
moapi-84cfd496d9-8hv6m 1/1 Running 0 29h
notifications-5b6775cd46-vnrd9 1/1 Running 0 2d4h
rtime-6bf5556964-495wv 1/1 Running 0 3d*
connect to a pod using shell with the next command
> kubectl exec -it auth-55fc8fb6f5-dv4km -- /bin/sh

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.