k8s-基本命令

k8s基本命令

问题:常用的命令有哪些?有什么用?怎么用?

解答

kubectl edit

k8s修改资源设置

po
kubectl edit po <your_poName>
svc
kubectl edit svc <svc_name>
deploy
kubectl edit deploy <deployment_name>
(repulicate set)rs
kubectl edit rs <republicateSet_name>

kubectl exec

如同docker exec ,进入到pod容器里面的命令

kubectl cp

拷贝pod里面数据,pod里面容器需要安装tar的命令,从报错信息可以获取。

[root@host1 test]# kubectl cp pod-834063700-d9x0p:/entry/cpfile /test/cpfile
exec: "tar": executable file not found in $PATH
#安装tar
[root@pod-834063700-d9x0p entry]# yum -y install tar
Loaded plugins: fastestmirror
[root@host1 test]# kubectl cp pod-834063700-d9x0p:/entry/cpfile /test/cpfile 
tar: Removing leading `/' from member names

[root@host1 test]# ls
 cpfile             cp    

kubectl get

svc

kubectl get svc --namespace==kube.system
pod
kubectl get po --namespace=kube-system
#或者
kubectl get pods -n kube-system
NAME                                        READY     STATUS             RESTARTS   AGE
calico-etcd-j48s1                           1/1       Running            0          6d
calico-node-123s0                           1/2       CrashLoopBackOff   1898       6d
calico-policy-controller-1727037546-m46kq   1/1       Running            0          6d
etcd-host1.ambari.com                       1/1       Running            0          6d
kube-apiserver-host1.ambari.com             1/1       Running            0          6d
kube-controller-manager-host1.ambari.com    1/1       Running            0          6d
kubectl get pods --all-namespaces
namespace
kubectl get namespace
NAME          STATUS    AGE
default       Active    6d
kube-public   Active    6d
kube-system   Active    6d
events
kubectl get events --all-namespaces

kubectl describe

pod
kubectl describe po --namespace=kube-system calico-node-123s0

参考

1.http://blog.csdn.net/liumiaocn/article/details/73925301
2.k8s api server

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值