In this example, we:
- Install a
Deployment
replicating annginx
Pod
3 times in a Kubernetes cluster. - Install a
Service
exposing thosenginx
Pod
s to the Internet. - Use
kubespy trace
to watch what happens to thatPod
as it starts.
You'll need:
- Access to a Kubernetes cluster. If you are using Pulumi, you can
trivially boot an
GKE,
AKS, or
EKS cluster.
NOTE: If you use minikube,
you'll need to change the
Service
's type to beClusterIP
, as minikube does not support typeLoadBalancer
. - Either the Pulumi CLI or
kubectl
. There is nothing Pulumi-specific in this example, so you can usekubectl
, but we hope you'll give Pulumi a shot! The CLI installation instructions here. Pulumi works anywherekubectl
works (i.e., anywhere you have a kubeconfig file), so it should "just work" if you already have a Kubernetes cluster running. kubespy
. Installation is a handful of commands, which you can find in the README.
Once these are complete, you'll want to do two things:
-
Run
kubespy
. Once you've installed it, this should be as simple askubespy status v1 Pod nginx
.kubespy
will dutifully wait for you to deploy aPod
callednginx
to your cluster. -
Run the example.
kubespy
repository contains a tiny example Pod that deploys an NGINX container.# With Pulumi CLI. $ git clone git@github.com:pulumi/kubespy.git $ cd kubespy/examples/trivial-service-trace-example $ npm install $ pulumi up # With kubectl. kubectl create -f https://github.com/pulumi/kubespy/raw/master/examples/trivial-service-trace-example/yaml/nginx.yaml
Once done, running kubespy trace service nginx
should display something like this: