一拳搞定 Kubenetes | 入门教程
目标:跟着官方入门教程走一遍
创建
创建 deployment

创建 service

查看 Pod

查看暴露的地址



简单总结
Last updated
目标:跟着官方入门教程走一遍






Last updated
tiechengdeMacBook-Pro-2:docker-compose tc$ kb create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
deployment.apps/hello-minikube createdtiechengdeMacBook-Pro-2:docker-compose tc$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
hello-minikube 1/1 1 1 17mtiechengdeMacBook-Pro-2:docker-compose tc$ kubectl expose deployment hello-minikube --type=NodePort --port=8778
service/hello-minikube exposedtiechengdeMacBook-Pro-2:docker-compose tc$ kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube NodePort 10.96.74.40 <none> 8778:31259/TCP 5m41s
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 22htiechengdeMacBook-Pro-2:docker-compose tc$ kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-minikube-797f975945-hqnfk 1/1 Running 0 15mtiechengdeMacBook-Pro-2:docker-compose tc$ minikube service hello-minikube --url
http://192.168.64.3:31259{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "192.168.64.3",
"MachineName": "minikube",
"SSHUser": "docker",
...
} tiechengdeMacBook-Pro-2:.kube tc$ ping -c 4 192.168.64.3
PING 192.168.64.3 (192.168.64.3): 56 data bytes
64 bytes from 192.168.64.3: icmp_seq=0 ttl=64 time=0.249 ms
64 bytes from 192.168.64.3: icmp_seq=1 ttl=64 time=0.240 ms
64 bytes from 192.168.64.3: icmp_seq=2 ttl=64 time=0.261 ms
64 bytes from 192.168.64.3: icmp_seq=3 ttl=64 time=0.449 ms
--- 192.168.64.3 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.240/0.300/0.449/0.086 mstiechengdeMacBook-Pro-2:.kube tc$ curl http://192.168.64.3:31259
Hostname: hello-minikube-797f975945-hqnfk
Pod Information:
-no pod information available-
Server values:
server_version=nginx: 1.13.3 - lua: 10008
Request Information:
client_address=172.17.0.1
method=GET
real path=/
query=
request_version=1.1
request_scheme=http
request_uri=http://192.168.64.3:8080/
Request Headers:
accept=*/*
host=192.168.64.3:31259
user-agent=curl/7.64.1
Request Body:
-no body in request-