
This example shows a simple two tier setup in Kubernetes, and simply prints the environment information that each pod sees. Querying the service multiple times will show services at work load balancing requests.
31 lines
647 B
YAML
31 lines
647 B
YAML
---
|
|
apiVersion: v1
|
|
kind: ReplicationController
|
|
metadata:
|
|
name: backend-rc
|
|
labels:
|
|
type: backend-type
|
|
spec:
|
|
replicas: 3
|
|
template:
|
|
metadata:
|
|
labels:
|
|
type: backend-type
|
|
spec:
|
|
containers:
|
|
- name: backend-container
|
|
image: gcr.io/google-samples/env-backend:1.1
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- containerPort: 5000
|
|
protocol: TCP
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|