容器部署与简单应用

  1. 开启hyper-v
  2. Win10 安装 Docker for Windows
  3. 配置加速器:注册阿里云 https://cr.console.aliyun.com/#/accelerator
  4. 配置私有镜像 harbor

Tips:默认Docker的镜像文件都是存储在Hyper-V的默认目录下,

开始 -> Windows 管理工具 -> Hyper-V管理器 -> 设置 -> 虚拟硬盘,

我们可以修改,具体参考 https://www.jianshu.com/p/fd780d0469d4

  1. 指向私有镜像仓库
  2. 安装Rancher Server

https://rancher.com/docs/rancher/v1.6/zh/installing-rancher/installing-server/

  1. docker pull rancher/server  安装
  2. docker images            查看已有镜像
  3. 配置

docker run -d --restart=unless-stopped -p 8090:8080 rancher/server

docker ps 查看实例

Docker logs -f 84  查看实例启动过程

打开Ipv4:8090  查看 rancher server

  1. 环境管理 -> 添加环境

Tips: Cattle, K8s, Swarm 编排工具

  1. 相应环境内添加主机

公网ipipconfig查看Ipv4地址

主机iprancher ui 系统管理 -> 系统设置查看

  1. 访问控制admin 123456

1.Hyper-v创建虚拟linux主机:新建添加ubuntu

2.ubuntu虚拟机配置交换机为默认

3.Ubuntu获取临时权限sudo -i

4.自动安装 Docker 及手动安装17.03

https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-docker-ce-1

https://yq.aliyun.com/articles/110806

  1. 加速器

sudo nano /etc/docker/daemon.json 添加以下加速器

{

“registry-mirriors”: [“https://jhq6kk07.mirror.aliyuncs.com

”]

}

Ctrl+X    Y    回车退出

  1. k8s部署

https://www.bladewan.com/2018/03/26/rke部署kubernetes/

https://github.com/kubernetes/kubernetes/tree/release-1.9       源码安装

  1. k8s命令

Kubectl get node查看已有节点

Kubectl cluster-info 查看集群信息

Kubectl get cs 查看组件健康状态

Kubectl get svc

Kubectl get pod --all-namespaces 查看所有命名空间的pod

Kubectl get namespaces 查看所有命名空间

Kubectl get pod --namespace=nginx -o wide 节点信息

Kubectl describe pod kube-dns-6f7666d48c-rzmgg --namespace=kube-system 查看pod信息

Kubectl get deployment

Kubectl get pod

Kubectl get node --show-labels 查看节点labels

官方:https://www.cnrancher.com/

  1. rancher2.0

docker run -d -p 80:80 -p 443:443 rancher/rancher:v2.0.0

  1. 部署k8s 节点注意事项,建议起一个docker空白虚拟机,可避免以下操作:

https://forums.cnrancher.com/article/39

  1. 配置workload所需参数

https://hub.docker.com/explore/

Images:

ubuntu:xenial

Nodeport:  每个node 的同一端口都能映射访问

Hostport:设置的当前node映射访问

猜你喜欢

转载自www.cnblogs.com/yuqlblog/p/9105721.html