k8s实用指令

2019/11/29 posted in  Kubernetes

创建Docker私有仓库密钥

kubectl create secret docker-registry regsecret --docker-server=registry.cn-hangzhou.aliyuncs.com --docker-username=yin32167@aliyun.com --docker-password=xxxxxx --docker-email=yin32167@aliyun.com

k8s简单端口转发

转发至pod

kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000

转发至service

kubectl port-forward --address 0.0.0.0 services/myservice 8888:5000

移除node

移除node需要先将node上的pod转移

kubectl drain k8s-node-storage --delete-local-data --force --ignore-daemonsets

然后利用delete命令删除node

kubectl delete node node-01

k8s创建tls secret

kubectl create secret tls dev.youxuetong.com --cert=server.crt --key=server.key -n share