minikube的简单命令

之前安装好了minikube,下面使用一些关于minikube的相关命令:

  • 获取有关运行节点的信息
[zhoujing@zhouj Code]$ kubectl get pod
No resources found.
[zhoujing@zhouj Code]$ kubectl get node
NAME       STATUS    AGE       VERSION
minikube   Ready     1d        v1.7.0
#创建名为hello-minikube的pod
[zhoujing@zhouj Code]$ kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
deployment "hello-minikube" created
[zhoujing@zhouj Code]$ kubectl get pod
NAME                             READY     STATUS              RESTARTS   AGE
hello-minikube-180744149-r908g   0/1       ContainerCreating   0          1m
[zhoujing@zhouj Code]$ kubectl get pod
NAME                             READY     STATUS    RESTARTS   AGE
hello-minikube-180744149-r908g   1/1       Running   0          6m
  • 描述运行节点的所有信息
[zhoujing@zhouj Code]$ kubectl describe pod hello-minikube-180744149-r908g
Name:       hello-minikube-180744149-r908g
Namespace:  default
Node:       minikube/192.168.99.100
Start Time: Wed, 02 Aug 2017 15:11:10 +0800
Labels:     pod-template-hash=180744149
        run=hello-minikube
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"hello-minikube-180744149","uid":"c2e163c6-7751-11e7-8ad5-080027d...
Status:     Running
IP:     172.17.0.4
Created By: ReplicaSet/hello-minikube-180744149
Controlled By:  ReplicaSet/hello-minikube-180744149
Containers:
  hello-minikube:
    Container ID:   docker://864dfca373db0d1e32579adaec2341673bc3508eb047150597c5ffc6cef6ab19
    Image:      gcr.io/google_containers/echoserver:1.4
    Image ID:       docker-pullable://gcr.io/google_containers/echoserver@sha256:5d99aa1120524c801bc8c1a7077e8f5ec122ba16b6dda1a5d3826057f67b9bcb
    Port:       8080/TCP
    State:      Running
      Started:      Wed, 02 Aug 2017 15:11:36 +0800
    Ready:      True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-23mkf (ro)
Conditions:
  Type      Status
  Initialized   True 
  Ready     True 
  PodScheduled  True 
Volumes:
  default-token-23mkf:
    Type:   Secret (a volume populated by a Secret)
    SecretName: default-token-23mkf
    Optional:   false
QoS Class:  BestEffort
Node-Selectors: <none>
Tolerations:    <none>
Events:
  FirstSeen LastSeen    Count   From            SubObjectPath           Type        Reason          Message
  --------- --------    -----   ----            -------------           --------    ------          -------
  6m        6m      1   default-scheduler                   Normal      Scheduled       Successfully assigned hello-minikube-180744149-r908g to minikube
  6m        6m      1   kubelet, minikube                   Normal      SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "default-token-23mkf" 
  6m        6m      1   kubelet, minikube   spec.containers{hello-minikube} Normal      Pulling         pulling image "gcr.io/google_containers/echoserver:1.4"
  6m        6m      1   kubelet, minikube   spec.containers{hello-minikube} Normal      Pulled          Successfully pulled image "gcr.io/google_containers/echoserver:1.4"
  6m        6m      1   kubelet, minikube   spec.containers{hello-minikube} Normal      Created         Created container
  6m        6m      1   kubelet, minikube   spec.containers{hello-minikube} Normal      Started         Started container
  • 暴露pod的端口;显示访问地址
[zhoujing@zhouj Code]$ kubectl expose deployment  hello-minikube --type=NodePort
service "hello-minikube" exposed
[zhoujing@zhouj Code]$ minikube service hello-minikube --url
http://192.168.99.100:30299
  浏览网页,显示内容如下:

CLIENT VALUES:
client_address=172.17.0.1
command=GET
real path=
query=nil
request_version=1.1
request_uri=http://192.168.99.100:8080/demo
SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001
HEADERS RECEIVED:
accept=text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
accept-encoding=gzip, deflate
accept-language=en-US,en;q=0.5
connection=keep-alive
host=192.168.99.100:30299
upgrade-insecure-requests=1
user-agent=Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
BODY:
-no body in request-

  • 停止minikube
[zhoujing@zhouj Code]$ minikube stop
Stopping local Kubernetes cluster...
Machine stopped.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值