-
-
Save shudipta/cc4376cfcf63fb026e6c7e52559fc69b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 create -f sts-svc.yaml | |
$ kubectl logs -f web-0 | |
PING web-0.test (10.28.0.104): 56 data bytes | |
64 bytes from 10.28.0.104: seq=0 ttl=64 time=0.029 ms | |
--- web-0.test ping statistics --- | |
1 packets transmitted, 1 packets received, 0% packet loss | |
round-trip min/avg/max = 0.029/0.029/0.029 ms | |
PING web-1.test (10.28.2.71): 56 data bytes | |
64 bytes from 10.28.2.71: seq=0 ttl=62 time=1.357 ms | |
--- web-1.test ping statistics --- | |
1 packets transmitted, 1 packets received, 0% packet loss | |
round-trip min/avg/max = 1.357/1.357/1.357 ms | |
PING web-2.test (10.28.1.81): 56 data bytes | |
64 bytes from 10.28.1.81: seq=0 ttl=62 time=1.515 ms | |
--- web-2.test ping statistics --- | |
1 packets transmitted, 1 packets received, 0% packet loss | |
round-trip min/avg/max = 1.515/1.515/1.515 ms |
This file contains hidden or 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: Service | |
metadata: | |
name: test | |
spec: | |
ports: | |
- port: 80 | |
name: web | |
clusterIP: None | |
selector: | |
tier: backend | |
--- | |
apiVersion: apps/v1 | |
kind: StatefulSet | |
metadata: | |
name: web | |
spec: | |
serviceName: "test" | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: test | |
template: | |
metadata: | |
labels: | |
app: test | |
tier: backend | |
spec: | |
containers: | |
- name: test | |
image: busybox | |
command: | |
- sh | |
- -c | |
- | | |
sleep 10 | |
ping web-0.test -c 1 | |
echo | |
ping web-1.test -c 1 | |
echo | |
ping web-2.test -c 1 | |
echo | |
sleep 5 | |
ports: | |
- containerPort: 80 | |
name: web |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment