<div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post">
<link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-e2445db1a8.css">
<div class="htmledit_views">
<p>查看kubernetes管理的pods</p>
[root@centos-master kubeguide]# kubectl get pods
NAME READY STATUS RESTARTS AGE
redis-master-u3824 1/1 Running 0 15m
查看kubernetes管理的nodes
[root@centos-master kubeguide]# kubectl get nodes
NAME LABELS STATUS AGE
centos-master kubernetes.io/hostname=centos-master Ready 3d
centos-minion kubernetes.io/hostname=centos-minion Ready 3d
查看Replication Controller
[root@centos-master kubeguide]# kubectl get rc
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS AGE
redis-master master kubeguide/redis-master name=redis-master 1 1h
删除资源
[root@centos-master kubeguide]# kubectl stop -f redis-master-controller.yaml
查看Service状态
[root@centos-master kubeguide]# kubectl describe service frontend
Name: frontend
Namespace: default
Labels: name=frontend
Selector: name=frontend
Type: NodePort
IP: 10.10.55.133
Port: <unnamed> 80/TCP
NodePort: <unnamed> 30001/TCP
Endpoints: 172.17.0.10:80,172.17.0.7:80,172.17.0.8:80
Session Affinity: None
No events.
[root@centos-master kubeguide]# kubectl describe pods redis-master
Name: redis-master-b7u7l
Namespace: default
Image(s): kubeguide/redis-master
Node: centos-minion/
Start Time: Tue, 23 Feb 2016 14:49:35 +0800
Labels: name=redis-master
Status: Pending
Reason:
Message:
IP:
Replication Controllers: redis-master (1/1 replicas created)
Containers:
master:
Container ID:
Image: kubeguide/redis-master
Image ID:
QoS Tier:
memory: BestEffort
cpu: BestEffort
State: Waiting
Ready: False
Restart Count: 0
Environment Variables:
No volumes.
Events:
FirstSeen LastSeen Count From SubobjectPath Reason Message
───────── ──────── ───── ──── ───────────── ────── ───────
38m 38m 1 {kubelet centos-minion} implicitly required container POD Pulled Successfully pulled image “registry.access.redhat.com/rhel7/pod-infrastructure:latest“
38m 38m 1 {kubelet centos-minion} implicitly required container POD Created Created with docker id 3f6c9cdd351a
38m 38m 1 {kubelet centos-minion} implicitly required container POD Started Started with docker id 3f6c9cdd351a
38m 38m 1 {kubelet centos-minion} spec.containers{master} Pulling pulling image “kubeguide/redis-master”
59s 59s 1 {kubelet centos-minion} implicitly required container POD Pulled Container image “registry.access.redhat.com/rhel7/pod-infrastructure:latest” already present on machine
54s 54s 1 {kubelet centos-minion} implicitly required container POD Created Created with docker id 83c6847b9cd7
53s 53s 1 {kubelet centos-minion} implicitly required container POD Started Started with docker id 83c6847b9cd7
53s 53s 1 {kubelet centos-minion} spec.containers{master} Pulling pulling image “kubeguide/redis-master”
查看etcd中的数据
etcdctl –endpoint http://10.10.3.184:2379 ls /registry
重新设置pod副本数
kubectl scale –replicas=4 replicationcontrollers frontend
本文详细介绍如何使用kubectl命令管理Kubernetes集群,包括查看pods、nodes、ReplicationController的状态,调整pod副本数,以及查看Service和etcd数据。通过具体实例,帮助读者掌握Kubernetes的基本操作。

1154

被折叠的 条评论
为什么被折叠?



