k8s集群操作命令及常见问题

1.创建k8s-api管理员token

# 创建token
kubectl create serviceaccount k8s-admin -n kube-system
kubectl create clusterrolebinding k8s-admin --clusterrole=cluster-admin --serviceaccount=kube-system:k8s-admin
# 查看token
kubectl -n kube-system describe secrets $(kubectl -n kube-system get secret | grep k8s-admin | awk '{print $1}')

2.后端业务是 HTTPS 服务,是否可以通过 Ingress-Nginx 转发? 答:可以,在 annotations 中添加以下

annotations:
  nginx.ingress.kubernetes.io/backend-protocol: HTTPS

3.kubectl自动补全

yum -y install bash-completion

source /usr/share/bash-completion/bash_completion

source <(kubectl completion bash)

echo "source <(kubectl completion bash)" >> ~/.bashrc

你可能感兴趣的:(k8s从入门到放弃,kubernetes,容器,云原生)