Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/bin/ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: trivial-nginx | ||
runtime: nodejs | ||
description: Basic example of an Kubernetes sample based on \ | ||
https://kubernetes.io/docs/user-guide/walkthrough/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 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` `Pod`s 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](https://github.com/pulumi/examples/tree/master/gcp-ts-gke), | ||
[AKS](https://github.com/pulumi/examples/tree/master/azure-ts-aks-mean), or | ||
[EKS](https://github.com/pulumi/examples/tree/master/aws-ts-eks) cluster. | ||
**NOTE:** If you use [minikube](https://github.com/kubernetes/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](https://pulumi.io/quickstart/install.html). 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](https://github.com/pulumi/kubespy#installation). | ||
|
||
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. | ||
|
||
```sh | ||
# 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](../../images/trace/trace-success.gif "Changes a Service undergoes as it starts, in real time") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright 2016-2018, Pulumi Corporation. All rights reserved. | ||
|
||
import * as k8s from "@pulumi/kubernetes"; | ||
|
||
// Create an nginx pod | ||
let nginx = new k8s.yaml.ConfigFile("yaml/nginx.yaml"); |
Oops, something went wrong.