Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 2.24 KB

File metadata and controls

48 lines (38 loc) · 2.24 KB

Example: What happens when a Service starts?

In this example, we:

  • Install a Deployment replicating an nginx Pod 3 times in a Kubernetes cluster.
  • Install a Service exposing those nginx Pods to the Internet.
  • Use kubespy trace to watch what happens to that Pod 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 be ClusterIP, as minikube does not support type LoadBalancer.
  • Either the Pulumi CLI or kubectl. There is nothing Pulumi-specific in this example, so you can use kubectl, but we hope you'll give Pulumi a shot! The CLI installation instructions here. Pulumi works anywhere kubectl 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:

  1. Run kubespy. Once you've installed it, this should be as simple as kubespy status v1 Pod nginx. kubespy will dutifully wait for you to deploy a Pod called nginx to your cluster.

  2. 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:

Changes