Experiment: Run simple program on Minikuber

Source: Internet
Author: User
Keywords Run simple programs validate experiments describe pod related information minikuber
Tags app clone cloning code course default display example
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/ 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/ 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> 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 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 8080:30299/tcp 2h kubernetes 443/tcp 1d nodehelloworld-dervice 3000:30602/ TCP 3m
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.