How to build a standardized vmware image for kubernetes under rancher

How to build a standardized vmware image for kubernetes under rancher

When learning kubernetes, we need to practice in the kubernetes environment. However, the kubernetes environment installation is not containerized. Now we can simplify the installation process through rancher. Let's practice kubernetes under rancher.

The entire practice is divided into two chapters: "Building a standardized vmware image" and "Installing and deploying rancher and kubernetes"

Prerequisites

Since you need to use Google's services, your network environment must be able to access the Internet scientifically. The specific solution will not be described here;

Actual combat environment

The computer used in this practice is Win10 Home Edition. Three Ubuntu16.04 virtual machines are run through VMware. One is used as Rancher Server to create a Kubernetes environment. The other two are added to this Kubernetes environment as nodes.

What is a standardized vmware image?

This practical exercise will use three Ubuntu virtual machines. It is obviously very time-consuming to start from installing Ubuntu, so we only install the Ubuntu system once, make some common settings on this system, install common applications, and then use the files of this virtual machine as a standardized image, copy three copies, and then you can start three virtual machines;

Installing the operating system

Download the installation file ubuntu-16.04.3-server-amd64.iso of Ubuntu Server 16.04.3 LTS from the Ubuntu official website;

Use the downloaded ubuntu-16.04.3-server-amd64.iso file to install a virtual machine on VMware. I used VMware® Workstation 12 Player , version 12.5.6 build-5528349, and the virtual machine hard disk was set to 60G and the memory was 2G.

Remotely connect to a virtual machine

After installing the system, use the SecureCRT tool to remotely connect to the virtual machine, as shown below:

After logging in, use the su - command to switch to the root account;

Set to allow remote root account login

Open the /etc/ssh/sshd_config file and find the following line:

PermitRootLogin prohibit-password

Change it to the following:

PermitRootLogin yes

Then execute the command service ssh restart to restart the ssh service. After that, you can log in to the virtual machine directly through the root account on SecureCRT.

Update Source

Log in to the virtual machine with the root account, open the /etc/apt/sources.list file, delete all the contents, and then add the following content (the source of Alibaba Cloud is currently faster):

# 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

After the update is complete, execute the apt-get update command to update with the latest source;

Install Docker

Install dependent applications:

apt-get install -y \
  apt-transport-https \
  ca-certificates \
  curl \
  software-properties-common

Download the package key and add it to the local trusted database:

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

Add ppa source:

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

Make an update

apt-get update

Install Docker

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

Start Docker

service docker start

View Docker status

service docker status

After successful startup, the status information is as follows:

Backup image file

Shut down the virtual machine, find the corresponding folder, and back up the entire folder as a standardized image. When we install the Rancher server and node nodes later, we can just copy these folders and open them.

In the next chapter, we will install the Rancher server, add the node to the server environment, and then experience Kubernetes.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed usage of kubernetes object Volume
  • A graphic tutorial on installing Rancher2 and configuring a kubernetes cluster in CentOS
  • Introduction to generating Kubernetes certificates using OpenSSL
  • Some major setting modification records when upgrading from kubernetes1.5.2 to kubernetes1.10
  • Introduction to Kubernetes (k8s)
  • Summary of Kubernetes's application areas

<<:  JavaScript implements color identification when the mouse passes over the table row

>>:  Vue achieves seamless carousel effect

Recommend

Complete steps to upgrade Nginx http to https

The difference between http and https is For some...

How to configure MySQL scheduled tasks (EVENT events) in detail

Table of contents 1. What is an event? 2. Enable ...

Vue implements sending emoticons in chat box

The specific code for sending emoticons in the vu...

Resolving MySQL implicit conversion issues

1. Problem Description root@mysqldb 22:12: [xucl]...

Details on how to use class styles in Vue

Table of contents 1. Boolean 2. Expression 3. Mul...

Analyze the selection problem of storing time and date types in MySQL

In general applications, we use timestamp, dateti...

Detailed explanation of how Angular handles unexpected exception errors

Written in front No matter how well the code is w...

Play with the connect function with timeout in Linux

In the previous article, we played with timeouts ...

Linux centOS installation JDK and Tomcat tutorial

First download JDK. Here we use jdk-8u181-linux-x...

How to implement blank space in Taobao with CSS3

Make a blank space for Taobao: When you shrink th...

Web Design Tutorial (8): Web Page Hierarchy and Space Design

<br />Previous article: Web Design Tutorial ...

Vue's new partner TypeScript quick start practice record

Table of contents 1. Build using the official sca...

Getting Started Tutorial on Animating SVG Path Strokes Using CSS3

Without relying on JavaScript, pure CSS is used t...

Detailed explanation of JS memory space

Table of contents Overview 1. Stack and Heap 2. V...