Last active
May 28, 2020 04:51
-
-
Save tomoyk/a717fb613d5ca1aaf6ed3c89757eea08 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: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
labels: | |
app: nginx | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: nginx | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
# image: nginx:1.7.9 | |
image: adongy/hostname-docker | |
ports: | |
- containerPort: 3000 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: my-www | |
spec: | |
type: clusterIP | |
selector: | |
app: nginx | |
ports: | |
- name: http | |
protocol: TCP | |
port: 80 | |
targetPort: 3000 | |
type: ClusterIP | |
externalIPs: | |
- 192.168.100.95 |
Author
tomoyk
commented
Sep 12, 2019
cdsl@k8s-study1:~$ while :
> do
> curl 192.168.100.95; echo;
> sleep 1;
> done
Hostname: nginx-deployment-7bd544b9fb-2tbmj
Hostname: nginx-deployment-7bd544b9fb-2tbmj
Hostname: nginx-deployment-7bd544b9fb-2tbmj
Hostname: nginx-deployment-7bd544b9fb-bwrpr
Hostname: nginx-deployment-7bd544b9fb-2tbmj
Hostname: nginx-deployment-7bd544b9fb-tlggp
Hostname: nginx-deployment-7bd544b9fb-tlggp
Hostname: nginx-deployment-7bd544b9fb-tlggp
Hostname: nginx-deployment-7bd544b9fb-2tbmj
Hostname: nginx-deployment-7bd544b9fb-2tbmj
Hostname: nginx-deployment-7bd544b9fb-bwrpr
Hostname: nginx-deployment-7bd544b9fb-tlggp
^C
cdsl@k8s-study1:~$
cdsl@k8s-study1:~$ k get all
NAME READY STATUS RESTARTS AGE
pod/nginx-deployment-7bd544b9fb-2tbmj 1/1 Running 0 3m41s
pod/nginx-deployment-7bd544b9fb-bwrpr 1/1 Running 0 3m41s
pod/nginx-deployment-7bd544b9fb-tlggp 1/1 Running 0 3m41s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 2d
service/my-www ClusterIP 10.152.183.52 192.168.100.95 80/TCP 3m41s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx-deployment 3/3 3 3 3m41s
NAME DESIRED CURRENT READY AGE
replicaset.apps/nginx-deployment-7bd544b9fb 3 3 3 3m41s
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment