【葵花宝典】All-in-One模式安装KubeSphere
作者:互联网
1.准备 Linux 机器
2.google api受限下载 KubeKey
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.0.1 sh -
chmod +x kk
3.开始安装
./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
./kk create cluster --with-kubernetes v1.17.9 --with-kubesphere v3.0.0
4.验证结果
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
5.K8S常用命令
kubectl create -f pod_nginx.yml //创建pod
kubectl apply -f nginx-pod.yaml //通过apply创建pod会记录pod最近的修改记录
kubectl delete -f pod_nginx.yml //删除pod
kubectl delete pod PODNAME --force --grace-period=0 //强制删除
kubectl scale rc nginx --replicas=2 //扩展pods
kubectl set image deploy kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2 //更新镜像版本
kubectl rollout status deployment kubernetes-bootcamp //查看更新的状态
kubectl rollout undo deploy kubernetes-bootcamp //执行更新回退
journalctl -f -u kube-proxy //查看对应日志是否为info级
kubectl logs wordpress-test-df8f45f5b-6gnjz -f //跟踪查看pods 日志
kubectl run php-apache --image=k8s.gcr.io/hpa-example --requests=cpu=200m --expose --port=80 // 创建自动扩展pod
kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10 // 自动扩展pod
kubectl get pods //查看pods
kubectl get pods -o wide //查看pods运行的相信信息
kubectl exec -it nginx bash //进入容器
kubectl describe pods nginx //打印描述pods
kubectl port-forward nginx 8080:80 //对pods进行端口映射
kubectl expose pods nginx-pod --type=NodePort //创建NodePort service
kubectl expose deploy kubernetes-bootcamp --type="NodePort" --target-port=8080 --port=80 //创建NodePort暴露服务端口
kubectl label node w1 hardware=good //给node打标签
kubectl get pods --show-labels //显示pods labels
kubectl run busybox --rm=true --image=busybox --restart=Never --tty -i //启动测试容器用以测试容器
标签:kubectl,kubernetes,--,pods,KubeSphere,nginx,葵花宝典,pod,安装 来源: https://www.cnblogs.com/liuqingliang/p/14301342.html