Skip to content

Commit 34d560a

Browse files
joonasadleong
authored andcommitted
Add example to demo using Kubernetes 1.4 Downward API instead of hostIP.sh (linkerd#37)
1 parent 141367a commit 34d560a

File tree

2 files changed

+115
-1
lines changed

2 files changed

+115
-1
lines changed

k8s-daemonset/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,22 @@ Deploy the hello and world python services, linkerd daemonset, and linkerd-viz
2828
to the default Kubernetes namespace.
2929

3030
```bash
31-
kubectl apply -f k8s/
31+
kubectl apply -f k8s/linkerd.yml
32+
kubectl apply -f k8s/linkerd-viz.yml
33+
kubectl apply -f k8s/hello-world.yml
3234
```
3335

36+
If you are running on Kubernetes 1.4 or later, you can alternatively run:
37+
38+
```bash
39+
kubectl apply -f k8s/linkerd.yml
40+
kubectl apply -f k8s/linkerd-viz.yml
41+
kubectl apply -f k8s/hello-world-1_4.yml
42+
```
43+
44+
The difference being that `k8s/hello-world-1_4.yml` makes use a Kubernetes
45+
feature only available in Kubernetes 1.4 and later.
46+
3447
# Verifying
3548

3649
## View linkerd admin page
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
apiVersion: v1
3+
kind: ReplicationController
4+
metadata:
5+
name: hello
6+
spec:
7+
replicas: 3
8+
selector:
9+
app: hello
10+
template:
11+
metadata:
12+
labels:
13+
app: hello
14+
spec:
15+
dnsPolicy: ClusterFirst
16+
containers:
17+
- name: service
18+
image: buoyantio/helloworld:0.0.1
19+
env:
20+
- name: NODE_NAME
21+
valueFrom:
22+
fieldRef:
23+
fieldPath: spec.nodeName
24+
- name: POD_IP
25+
valueFrom:
26+
fieldRef:
27+
fieldPath: status.podIP
28+
command:
29+
- "/bin/bash"
30+
- "-c"
31+
- "HTTP_PROXY=$(NODE_NAME):4140 python hello.py"
32+
ports:
33+
- name: service
34+
containerPort: 7777
35+
- name: kubectl
36+
image: buoyantio/kubectl:v1.4.0
37+
args:
38+
- proxy
39+
- "-p"
40+
- "8001"
41+
---
42+
apiVersion: v1
43+
kind: Service
44+
metadata:
45+
name: hello
46+
spec:
47+
selector:
48+
app: hello
49+
type: LoadBalancer
50+
ports:
51+
- name: http
52+
port: 7777
53+
- name: external
54+
port: 80
55+
targetPort: 7777
56+
---
57+
apiVersion: v1
58+
kind: ReplicationController
59+
metadata:
60+
name: world
61+
spec:
62+
replicas: 3
63+
selector:
64+
app: world
65+
template:
66+
metadata:
67+
labels:
68+
app: world
69+
spec:
70+
dnsPolicy: ClusterFirst
71+
containers:
72+
- name: service
73+
image: buoyantio/helloworld:0.0.1
74+
env:
75+
- name: NODE_NAME
76+
valueFrom:
77+
fieldRef:
78+
fieldPath: spec.nodeName
79+
- name: POD_IP
80+
valueFrom:
81+
fieldRef:
82+
fieldPath: status.podIP
83+
command:
84+
- "/bin/bash"
85+
- "-c"
86+
- "HTTP_PROXY=$(NODE_NAME):4140 python world.py"
87+
ports:
88+
- name: service
89+
containerPort: 7778
90+
---
91+
apiVersion: v1
92+
kind: Service
93+
metadata:
94+
name: world
95+
spec:
96+
selector:
97+
app: world
98+
clusterIP: None
99+
ports:
100+
- name: http
101+
port: 7778

0 commit comments

Comments
 (0)