kubernetes 学习记录-two

Kubectl 命令

kubectl get : Display one or many resources.

example :
kubectl get pods

获取~/.kube/config中配置的以 user 登录的 namaspace 下的所有 pod 。

kubectl get pods -o wide

List all pods in ps output format with more information (such as node name).

kubectl get services` or `kubectl get svc

List all services.

kubectl get -o json pod wkx-pod-2080863796-awf64

以json格式显示 wkx-pod-2080863796-awf64 的信息。

kubectl create : Create a resource by filename or stdin.

example :
kubectl create -f a.yaml

根据 a.yaml 文件创建 resource 。

kubectl edit : Edit a resource on the server.

example :
kubectl edit pod wkx-pod-2080863796-awf64

对 wkx-pod-2080863796-awf64 进行修改。kubernets 将以滚动升级的方式更新修改。

kubectl delete : Delete resources by filenames, stdin, resources and names, or by resources and label selector.

example :
kubectl delete -f a.yaml

将之前根据a.yaml文件创建的 resource 删除。

kubectl delete pod wkx-pod-2080863796-awf64

删除名为 wkx-pod-2080863796-awf64 的 pod 。

kubectl describe : Show details of a specific resource or group of resources.

example :
kubectl describe pods

显示所有的 pod 的信息。

kubectl describe pods -l app=test

显示 label app=test 的 pod 的信息。

kubectl run : Run a particular image on the cluster.

example :
kubectl run gobuilder --image=docker/kaixing.wu/golang:1.7.4

运行一个 docker/kaixing.wu/golang:1.7.4 的实例。

kubectl exec : Execute a command in a container.

example :
kubectl exec -it gobuilder-998763582-15gvi bash

以 bash 的形式进入 gobuilder-998763582-15gvi 这个 pod 。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值