kubectl和helm3命令笔记

mtain 2020年05月12日 919次浏览

kubectl

# 刷新着看所有空间中的所有pod
watch kubectl get pods --all-namespaces
watch kubectl get pods,svc --all-namespaces

# 根据yaml中的定义创建/删除应用
kubectl create -f whoami.yml
kubectl delete -f whoami.yml

# 查看各类资源
kubectl get node
kubectl get pod
kubectl get svc
kubectl get ingress

# 创建/删除空间
kubectl create namespace app
kubectl delete namespace app

# 指定空间查看资源
kubectl -n app get pod
kubectl --namespace app get pod

# 查看pod详情 错误信息等
kubectl describe pod chart-1586941688-whoami-758845657f-kjk7s

# yaml形式编辑资源
kubectl edit ingress chart-1586937737-whoami

helm

# 添加仓库
helm repo add stable https://kubernetes-charts.storage.googleapis.com/

# 查看所有仓库
helm repo list

# 仓库中查找
helm search repo stable

# 安装仓库中的应用
helm install stable/lamp --generate-name

# 安装插件
helm plugin install https://github.com/chartmuseum/helm-push

# 安装文件夹中定义的应用
helm install . --debug -n harbor --namespace harbor --generate-name

# 列出所有应用
helm list

# 卸载应用
helm uninstall chart-1586853720