Skip to content

Commit 06f6727

Browse files
feat: add a kustomize base to the repository (#144)
Adds a [kustomize application][1] that stands up a running instance of go-httpbin in a Kubernetes cluster. This is useful to reference as a remote kustomization via your own kustomization, or can be used as: kustomize build github.com/mccutchen/go-httpbin/kustomize | kubectl apply -f - or even as: kubectl apply -k github.com/mccutchen/go-httpbin/kustomize [1]: https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#application
1 parent dd8fc10 commit 06f6727

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ $ docker run -P mccutchen/go-httpbin
2323
$ docker run -e HTTPS_CERT_FILE='/tmp/server.crt' -e HTTPS_KEY_FILE='/tmp/server.key' -p 8080:8080 -v /tmp:/tmp mccutchen/go-httpbin
2424
```
2525

26+
### Kubernetes
27+
28+
```
29+
$ kubectl apply -k github.com/mccutchen/go-httpbin/kustomize
30+
```
31+
32+
See `./kustomize` directory for further information
33+
2634
### Standalone binary
2735

2836
Follow the [Installation](#installation) instructions to install go-httpbin as

kustomize/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
This folder is a [kustomize application](https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#application) that stands up a running instance of go-httpbin in a Kubernetes cluster.
2+
3+
You may wish to utilise this as a [remote application](https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/resource/), e.g.
4+
5+
```yaml
6+
apiVersion: kustomize.config.k8s.io/v1beta1
7+
kind: Kustomization
8+
commonLabels:
9+
app.kubernetes.io/name: httpbin
10+
resources:
11+
- github.com/mccutchen/go-httpbin/kustomize
12+
images:
13+
- name: mccutchen/go-httpbin
14+
```
15+
16+
To expose your instance to the internet, you could add an `Ingress` in an overlay:
17+
```yaml
18+
apiVersion: networking.k8s.io/v1
19+
kind: Ingress
20+
metadata:
21+
name: httpbin
22+
spec:
23+
ingressClassName: myingressname
24+
rules:
25+
- host: my-go-httpbin.com
26+
http:
27+
paths:
28+
- path: /
29+
pathType: Prefix
30+
backend:
31+
service:
32+
name: httpbin
33+
port:
34+
name: http
35+
tls:
36+
- hosts:
37+
- my-go-httpbin.com
38+
secretName: go-httpbin-tls
39+
```

kustomize/kustomization.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
commonLabels:
4+
app.kubernetes.io/name: httpbin
5+
resources:
6+
- resources.yaml
7+
images:
8+
- name: mccutchen/go-httpbin

kustomize/resources.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: httpbin
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: httpbin
10+
image: mccutchen/go-httpbin
11+
ports:
12+
- name: http
13+
containerPort: 8080
14+
protocol: TCP
15+
livenessProbe:
16+
httpGet:
17+
path: /status/200
18+
port: http
19+
readinessProbe:
20+
httpGet:
21+
path: /status/200
22+
port: http
23+
resources: {}
24+
---
25+
apiVersion: v1
26+
kind: Service
27+
metadata:
28+
name: httpbin
29+
spec:
30+
ports:
31+
- port: 80
32+
targetPort: http
33+
protocol: TCP
34+
name: http

0 commit comments

Comments
 (0)