• rancher下的kubernetes之一:构建标准化vmware镜像


    学习kubernetes的时候,我们需要在kubernetes环境下实战操作,然而kubernetes环境安装并不容易,现在通过rancher可以简化安装过程,咱们来实战rancher下的kubernetes吧;

    整个实战分为两章:《构建标准化vmware镜像》和《安装部署rancher、kubernetes》

    前提条件

    由于要用到谷歌的服务,所以要求您的网络环境可以科学上网,具体的方案就不在这里说了;

    实战环境

    本次实战用的电脑是win10家庭版,通过vmware运行三个ubuntu16.04的虚拟机,一个作为rancher server,在上面创建kubernetes环境,另外两台作为节点加入到这个kubernetes环境中;

    标准化vmware镜像是什么?

    本次实战要用三个ubuntu虚拟机,如果都从安装ubuntu开始显然很费时,所以我们只装一次ubuntu系统,在这个系统上做一些通用的设置,装上通用的应用,然后把这个虚拟机的文件作为标准化镜像,复制三份,就可以启动三个虚拟机了;

    安装操作系统

    1. 在ubuntu官网下载Ubuntu Server 16.04.3 LTS的安装文件ubuntu-16.04.3-server-amd64.iso
    2. 用下载好的ubuntu-16.04.3-server-amd64.iso文件在vmware上安装一个虚拟机,我用的是VMware® Workstation 12 Player,版本号12.5.6 build-5528349,虚拟机硬盘设置为60G,内存2G;

    远程连接到虚拟机

    装好系统后,用SecureCRT工具远程连接到虚拟机上,如下图: 
    这里写图片描述

    登录后用su -命令切换到root账号;

    设置允许远程root账号登录

    打开/etc/ssh/sshd_config文件,找到下面这一行:

    PermitRootLogin prohibit-password

    改成下面这样:

    PermitRootLogin yes

    然后执行命令service ssh restart重启ssh服务,以后就可以在SecureCRT上通过root账号直接登录虚拟机了;

    更新源

    root账号登录虚拟机,打开/etc/apt/sources.list文件,将内容全部删除,然后增加以下内容(阿里云的源,目前速度较快):

    # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
    deb http://archive.canonical.com/ubuntu xenial partner
    deb-src http://archive.canonical.com/ubuntu xenial partner
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

    更新完毕后,执行apt-get update命令,用最新的源进行更新;

    安装docker

    • 安装依赖应用:
    apt-get install -y 
        apt-transport-https 
        ca-certificates 
        curl 
        software-properties-common

    下载软件包密钥,并添加到本地trusted数据库中:

    curl -fsSL https://download.daocloud.io/docker/linux/ubuntu/gpg | sudo apt-key add -

    添加 ppa 源:

    add-apt-repository 
       "deb [arch=$(dpkg --print-architecture)] https://download.daocloud.io/docker/linux/ubuntu 
       $(lsb_release -cs) 
       stable"

    做一次更新

    apt-get update

    安装docker

    apt-get install -y -q docker-ce=17.03.2*

    启动docker

    service docker start

    查看docker状态

    service docker status

    启动成功后状态信息如下图:

    这里写图片描述

    备份镜像文件

    关闭虚拟机,找到对应的文件夹,把整个文件夹作为标准化的镜像备份起来,后续我们安装rancher的server和node节点的时候,直接复制这些文件夹然后打开就可以了;

    下一章,我们将安装rancher的server,再把node节点加入到server环境中,然后体验kubernetes;

  • 相关阅读:
    VB.net byval和byref
    IOS 常用宏定义(二)
    目录权限Linux存储实验四:NFS的安装与配置
    服务器负载均衡nginx+keepalived 高可用负载均衡
    博客文件第二部分 Linux Shell高级编程技巧——第一章 深入讨论
    查看进程第二部分 Linux Shell高级编程技巧——第二章 Shell工具
    响应命令使用Ubuntu架设ftp服务器
    进程内存Linux下top命令
    客户端服务器SSH原理和使用
    安装数据空间虚拟CentOS访问Windows下共享文件
  • 原文地址:https://www.cnblogs.com/yhaing/p/8568262.html
Copyright © 2020-2023  润新知