首页
技术小册
AIGC
面试刷题
技术文章
MAGENTO
云计算
视频课程
源码下载
PDF书籍
「涨薪秘籍」
登录
注册
Kubectl
1. 查看相关信息
1.1. get
1.1.1. 基本信息查看
1.1.2. 根据标签筛选
1.2. describe
1.3. 其它集群信息
2. 创建资源
2.1. run(弃用)
2.2. create
2.3. 创建service资源
3. 扩缩容
4. 删除资源
5. 贴附到pod上
6. 查看资源清单文档
7. 代理
8. Kubectl 命令补全
标签/标签选择器
1. Label
1.1. 标签的查看
1.2. 常用的标签字段
1.3. 标签的语法
1.4. 打标签
2. Annotations
3. 选择器
3.1. 标签选择器
3.1.1. 标签选择器类型
3.1.2. 标签选择器的使用
3.2. 字段选择器
当前位置:
首页>>
技术小册>>
Kubernets合辑4-kubernetes入门
小册名称:Kubernets合辑4-kubernetes入门
``` Usage: kubectl get resource [-o wide|json|yaml] [-n namespace] Man: 获取资源的相关信息,-n 指定名称空间,-o 指定输出格式 resource可以是具体资源名称,如pod nginx-xxx;也可以是资源类型,如pod;或者all(仅展示几种核心资源,并不完整) -A, --all-namespace 表示显示所有名称空间 ``` ``` [root@hdss7-21 ~]# kubectl get cs NAME STATUS MESSAGE ERROR controller-manager Healthy ok scheduler Healthy ok etcd-1 Healthy {"health": "true"} etcd-2 Healthy {"health": "true"} etcd-0 Healthy {"health": "true"} [root@hdss7-21 ~]# kubectl get node -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME hdss7-21.host.com Ready master,node 11d v1.15.2 10.4.7.21 <none> CentOS Linux 7 (Core) 3.10.0-862.el7.x86_64 docker://19.3.5 hdss7-22.host.com Ready master,node 11d v1.15.2 10.4.7.22 <none> CentOS Linux 7 (Core) 3.10.0-862.el7.x86_64 docker://19.3.5 [root@hdss7-21 ~]# kubectl get svc -o wide -n kube-system NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR coredns ClusterIP 192.168.0.2 <none> 53/UDP,53/TCP,9153/TCP 4d20h k8s-app=coredns kubernetes-dashboard ClusterIP 192.168.140.139 <none> 443/TCP 3d9h k8s-app=kubernetes-dashboard traefik-ingress-service ClusterIP 192.168.45.46 <none> 80/TCP,8080/TCP 3d19h k8s-app=traefik-ingress [root@hdss7-21 ~]# kubectl get pod nginx-ds-jdp7q -o yaml apiVersion: v1 kind: Pod metadata: creationTimestamp: "2020-01-13T13:13:02Z" generateName: nginx-ds- labels: app: nginx-ds ...... [root@centos-7-51 ~]# kubectl get pod -A NAMESPACE NAME READY STATUS RESTARTS AGE default pod-demo 1/1 Running 0 23m kube-system coredns-7cf6c46dd5-9phnm 1/1 Running 2 6d1h kube-system coredns-7cf6c46dd5-dm55x 1/1 Running 2 6d1h kube-system etcd-centos-7-51 1/1 Running 2 6d1h kube-system etcd-centos-7-52 1/1 Running 2 6d1h kube-system etcd-centos-7-53 1/1 Running 2 6d1h kube-system kube-apiserver-centos-7-51 1/1 Running 2 6d1h kube-system kube-apiserver-centos-7-52 1/1 Running 2 6d1h kube-system kube-apiserver-centos-7-53 1/1 Running 2 6d1h kube-system kube-controller-manager-centos-7-51 1/1 Running 3 6d1h kube-system kube-controller-manager-centos-7-52 1/1 Running 3 6d1h kube-system kube-controller-manager-centos-7-53 1/1 Running 3 6d1h kube-system kube-flannel-ds-c2bs6 1/1 Running 4 7d12h kube-system kube-flannel-ds-t6j77 1/1 Running 5 7d12h kube-system kube-flannel-ds-w526w 1/1 Running 4 7d12h kube-system kube-flannel-ds-wp546 1/1 Running 5 7d12h kube-system kube-flannel-ds-xc5cb 1/1 Running 3 7d12h kube-system kube-proxy-b2dcj 1/1 Running 4 6d1h kube-system kube-proxy-gjhjc 1/1 Running 4 6d1h kube-system kube-proxy-m6xn7 1/1 Running 4 6d1h kube-system kube-proxy-qpndv 1/1 Running 4 6d1h kube-system kube-proxy-tbjz8 1/1 Running 4 6d1h kube-system kube-scheduler-centos-7-51 1/1 Running 3 6d1h kube-system kube-scheduler-centos-7-52 1/1 Running 3 6d1h kube-system kube-scheduler-centos-7-53 1/1 Running 2 6d1h kube-system metrics-server-c66c59557-vbhq4 1/1 Running 2 6d kube-system traefik-ingress-controller-2gpfs 1/1 Running 3 7d11h kube-system traefik-ingress-controller-8jhgb 1/1 Running 3 7d11h kubernetes-dashboard dashboard-metrics-scraper-894c58c65-58ftb 1/1 Running 2 6d20h kubernetes-dashboard kubernetes-dashboard-ffb9ffc86-2np2t 1/1 Running 2 6d17h storage nfs-client-provisioner-5bdc64dd59-ss8cm 1/1 Running 3 6d ```
上一篇:
1.1. get
下一篇:
1.1.2. 根据标签筛选
该分类下的相关小册推荐:
Kubernetes中文教程(六)
Kubernetes中文教程(二)
Kubernetes合辑1-安装Kubernetes
Kubernets合辑5-Pod控制器
Kubernets合辑12-配置中心
Kubernetes中文教程(四)
Kubernets合辑10-网络
Kubernetes中文教程(三)
Kubernets合辑15-持续部署
Kubernets合辑7-存储
Kubernetes中文教程(一)
云原生-K8S入门实战