Last active
October 15, 2019 13:35
-
-
Save Neraud/8bf29ea68507d7ecddddf462e287f298 to your computer and use it in GitHub Desktop.
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: echo-config | |
namespace: default | |
data: | |
text: first |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: echo-config | |
namespace: default | |
data: | |
text: second |
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
apiVersion: apps/v1 | |
kind: DaemonSet | |
metadata: | |
name: http-echo-daemonset | |
annotations: | |
reloader.stakater.com/auto: "true" | |
spec: | |
selector: | |
matchLabels: | |
app: http-echo-daemonset | |
template: | |
metadata: | |
labels: | |
app: http-echo-daemonset | |
spec: | |
containers: | |
- name: http-echo-daemonset | |
image: hashicorp/http-echo | |
args: | |
- "-text=$(TEXT)" | |
ports: | |
- containerPort: 80 | |
env: | |
- name: TEXT | |
valueFrom: | |
configMapKeyRef: | |
name: echo-config | |
key: text | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: http-echo-daemonset-service | |
spec: | |
type: NodePort | |
selector: | |
app: http-echo-daemonset | |
ports: | |
- port: 5678 | |
nodePort: 30003 |
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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: http-echo-deployment | |
annotations: | |
reloader.stakater.com/auto: "true" | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: http-echo-deployment | |
template: | |
metadata: | |
labels: | |
app: http-echo-deployment | |
spec: | |
containers: | |
- name: http-echo-deployment | |
image: hashicorp/http-echo | |
args: | |
- "-text=$(TEXT)" | |
ports: | |
- containerPort: 80 | |
env: | |
- name: TEXT | |
valueFrom: | |
configMapKeyRef: | |
name: echo-config | |
key: text | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: http-echo-deployment-service | |
spec: | |
type: NodePort | |
selector: | |
app: http-echo-deployment | |
ports: | |
- port: 5678 | |
nodePort: 30001 |
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
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: http-echo-statefulset | |
annotations: | |
reloader.stakater.com/auto: "true" | |
spec: | |
serviceName: "http-echo-statefulset" | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: http-echo-statefulset | |
template: | |
metadata: | |
labels: | |
app: http-echo-statefulset | |
spec: | |
containers: | |
- name: http-echo-statefulset | |
image: hashicorp/http-echo | |
args: | |
- "-text=$(TEXT)" | |
ports: | |
- containerPort: 80 | |
env: | |
- name: TEXT | |
valueFrom: | |
configMapKeyRef: | |
name: echo-config | |
key: text | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: http-echo-statefulset-service | |
spec: | |
type: NodePort | |
selector: | |
app: http-echo-statefulset | |
ports: | |
- port: 5678 | |
nodePort: 30002 |
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
kubectl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml | |
kubectl apply -f configMap_init.yaml | |
kubectl apply -f daemonSet.yaml | |
kubectl apply -f deployment.yaml | |
kubectl apply -f statefulSet.yaml | |
# Check value read from pods | |
curl -L http://192.168.99.100:30001 | |
curl -L http://192.168.99.100:30002 | |
curl -L http://192.168.99.100:30003 | |
# Should display 'first' | |
# To trigger a reload | |
kubectl apply -f configMap_updated.yaml | |
# Check value read from pods | |
curl -L http://192.168.99.100:30001 | |
curl -L http://192.168.99.100:30002 | |
curl -L http://192.168.99.100:30003 | |
# Should display 'second' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment