Validation experiment [Zhoujing@zhouj code]$ git clone https://github.com/wardviaene/kubernetes-course cloning to ' kubernetes-course ' ... Remote:counting objects:90, done. Remote:total (Delta 0), reused 0 (Delta 0), pack-reused 90 Expand Objects: 100% (90/90), complete. [Zhoujing@zhouj code]$ cd kubernetes-course/[Zhoujing@zhouj kubernetes-course]$ kubectl get node NAME STATUS age VERSION Minikube Ready 1d v1.7.0 [Zhoujing@zhouj kubernetes-course]$ cat first-app/helloworld.yml apiversion:v1 kind:pod Metadata:name:nodehelloworld.example.com labels:app:helloworld spec:containers:-Name:k8s-demo image:wardviaene/ K8s-demo ports:-Name:nodejs-port containerport:3000 Create pod [zhoujing@zhouj kubernetes-course]$ kubectl create-f First-app/helloworld.yml pod "nodehelloworld.example.com" created [Zhoujing@zhouj kubernetes-course]$ kubectl get pod NAME READY STATUS restarts age hello-minikube-180744149-r908g pagination Running 1 2h nodehelloworld.example.com 0/1 Containercreating 0 2m Description of pod related information [Zhoujing@zhouj kubernetes-course]$ kubectl describe pod nodehelloworld.example.com Name:nodehelloworld.example.com Node: minikube/192.168.99.100 Start time:wed, modified 2017 17:40:49 +0800 Labels:app=helloworld IP: Containers:k8s-demo:container Id:image:wardviaene/k8s-demo Image id:port:3000/tcp state:waiting Cited: containercreating ready:false Restart count:0 environment:mounts:/var/run/secrets/kubernetes.io/serviceaccount from DEFAULT-TOKEN-23MKF (RO) conditions:type Status initialized True Ready False [Zhoujing@zhouj kubernetes-course]$ Kubectl Describe pod nodehelloworld.example.com Name:nodehelloworld.example.com namespace:default node:minikube/ 192.168.99.100 Start time:wed modified 2017 17:40:49 +0800 Labels:app=helloworld Annotations:Status:Pending ip:containers : K8s-demo:container id:image:wardviaene/k8s-demo Image id:port:3000/tcp state:waiting reason:containercreating Ready : False Restart count:0 environment:mounts:/var/rUn/secrets/kubernetes.io/serviceaccount from Default-token-23mkf (RO) conditions:type Status initialized True Ready False display local port, Access view information [Zhoujing@zhouj kubernetes-course]$ kubectl port-forward nodehelloworld.example.com 8,081:3,000 Forwarding from 127.0.0.1:8081-> 3000 Forwarding to [:: 1]:8081-> 3000 handling connection for 8081 # In the browser port input: localhost:8081, the contents of the display information are as follows: Hello world! Expose pod ports; show access address [Zhoujing@zhouj kubernetes-course]$ kubectl expose pod nodehelloworld.example.com--type=nodeport the Service "nodehelloworld.example.com" is Invalid:metadata.name:Invalid value: "nodehelloworld.example.com": a DNS-1035 Label moment-in consist of lower case alphanumeric characters or '-', and moment-in start and end with a alphanumeric character (e.g. ' My-name ', or ' abc-123 ', regex used for validation is ' [A-z] ([-a-z0-9]*[a-z0-9]) [Zhoujing@zhouj kubernetes-course]$ kubectl expose pod nodehelloworld.example.com--type=nodeport--name Nodehelloworld-dervice Service "Nodehelloworld-dervice" Exposed [zhoujing@zhouj kubernetes-course]$ minikube service nodehelloworld-dervice--url http://192.168.99.100:30602 Browse Web page , the display reads as follows:
Hello world!
View service information [Zhoujing@zhouj kubernetes-course]$ kubectl Get service NAME cluster-ip external-ip PORT (S) Age Hello-minikube 10.0.0.38 8080:30299/tcp 2h kubernetes 10.0.0.1 443/tcp 1d nodehelloworld-dervice 10.0.0.247 3000:30602/ TCP 3m