码迷,mamicode.com
首页 > Web开发 > 详细

kubernetes之基本使用2

时间:2018-04-26 14:54:27      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:k8s

连接

通过kubectl来连接其他node上的pod中的容器

[root@m ~]# kubectl get pods -o wide
NAME                       READY     STATUS    RESTARTS   AGE       IP            NODE
busybox-3674381263-90hh9   1/1       Running   0          39m       172.30.83.2   192.168.56.202
[root@m ~]# kubectl get pods
NAME                       READY     STATUS    RESTARTS   AGE
busybox-3674381263-90hh9   1/1       Running   0          39m
[root@m ~]# kubectl get node
NAME             STATUS    AGE
192.168.56.201   Ready     2d
192.168.56.202   Ready     7d
[root@m ~]# kubectl exec -it busybox-3674381263-90hh9 sh
/ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
5: eth0@if6: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue 
    link/ether 02:42:ac:1e:53:02 brd ff:ff:ff:ff:ff:ff
    inet 172.30.83.2/24 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe1e:5302/64 scope link 
       valid_lft forever preferred_lft forever

故障

开始的时候不能连接,报错如下:

[root@m ~]# kubectl exec -it busybox-3674381263-90hh9 sh
Error from server: error dialing backend: dial tcp 192.168.56.202:10250: getsockopt: connection refused

排查结果是:
技术分享图片

kubernetes之基本使用2

标签:k8s

原文地址:http://blog.51cto.com/sgk2011/2108095

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!