1,docker的安装
## 使用阿里云镜像加速安装下载docker-ce
## 参考链接:https://yq.aliyun.com/articles/110806
# step 1: 安装必要的一些系统工具
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# Step 2: 添加软件源信息
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# Step 3: 更新并安装 Docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce
# Step 4: 开启Docker服务
sudo service docker start
2,配置 docker 加速器
## 参考链接https://www.daocloud.io/mirror
## 该脚本可以将 --registry-mirror 加入到你的 Docker 配置文件 /etc/docker/daemon.json 中。适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有细微不同。更多详情请访问文档。
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
5,k8s基础命令
## https://kubernetes.io/docs/tutorials/
##
kubectl get nodes
kubectl cluster-info
## deployment
kubectl run kubernetes-bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1 --port=8080
kubectl get nodes
##
kubectl expose deployment/kubernets-bootcamp --type="NodePort" --port=8080
kubectl get services
kubectl delete service -l run=kubernetes-bootcamp
kubectl get services
## scale
kubectl get deployments
kubectl scale deployments/kubernetes-bootcamp --replicas=3
kubectl get deployments
kubectl get nodes
kubectl scale deployments/kubernetes-bootcamp --replicas=2
kubectl get deployments
kubectl get nodes
##
kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
kubectl rollout undo deployments/kubernetes-bootcamp
kubectl get nodes
kubectl get namespace
kubectl 管理应用程序生命周期
1、创建
kubectl run nginx --replicas=3 --image=nginx:1.14 --port=80
kubectl get deploy,pods
2、发布
kubectl expose deployment nginx --port=80 --type=NodePort --target-port=80 --name=nginx-service
kubectl get service
3、更新
kubectl set image deployment/nginx nginx=nginx:1.15
4、回滚
kubectl rollout history deployment/nginx
kubectl rollout undo deployment/nginx
5、删除
kubectl delete deploy/nginx
kubectl delete svc/nginx-service