...
Issue the following commands on your vm. The master node will require 2 cores and 2GB memory.
...
Update apt-get
> sudo
...
su
...
> apt-get
...
update
Install openssh
> apt-get
...
install
...
openssh-server
Enable both network interfaces
If you are installing Ubuntu server it will enable a primary network interface.
For VirtualBox VMs we are using 2 network interfaces:
- a NAT network used for accessing the internet (primary)
- a host only network for accessing the host from our machine without having to setup port forwarding.
>ifconfig -a
Add the missing interface to your interfaces config file and reboot
> vi /etc/network/interfaces
Code Block |
---|
# This file describes the network interfaces available on your system #install docker apt-get install -y docker.io #install curl # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto enp0s8 iface enp0s8 inet dhcp auto enp0s3 iface enp0s3 inet dhcp |
> reboot
Login and get IP address:
> ifconfig
Code Block |
---|
enp0s3 Link encap:Ethernet HWaddr 08:00:27:56:82:00
inet addr:192.168.56.3 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe56:8200/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:170 errors:0 dropped:0 overruns:0 frame:0
TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18488 (18.4 KB) TX bytes:19156 (19.1 KB)
enp0s8 Link encap:Ethernet HWaddr 08:00:27:f0:a2:f5
inet addr:10.0.3.15 Bcast:10.0.3.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fef0:a2f5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:329 errors:0 dropped:0 overruns:0 frame:0
TX packets:141 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:389613 (389.6 KB) TX bytes:10690 (10.6 KB)
... |
Now you can ssh into the virtual machine on the host-only network from your host
> ssh test@192.168.56.3
Install Docker
> sudo su
> apt-get install -y docker.io
Install Curl
> apt-get install -y apt-transport-https
...
curl
Install Kubernetes
> curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg
...
|
...
apt-key
...
add
...
-
...
cat
...
<<EOF
...
>/etc/apt/sources.list.d/kubernetes.list
...
deb
...
https://apt.kubernetes.io/
...
kubernetes-xenial
...
main
...
EOF
...
> apt-get update
...
> apt-get
...
install
...
-y kubelet kubeadm kubectl
> apt-mark hold kubelet kubeadm kubectl
Pull images
> kubeadm config images pull
Code Block |
---|
[config/images] Pulled k8s.gcr.io/kube-apiserver:v1.13.1
[config/images] Pulled k8s.gcr.io/kube-controller-manager:v1.13.1
[config/images] Pulled k8s.gcr.io/kube-scheduler:v1.13.1
[config/images] Pulled k8s.gcr.io/kube-proxy:v1.13.1
[config/images] Pulled k8s.gcr.io/pause:3.1
[config/images] Pulled k8s.gcr.io/etcd:3.2.24
[config/images] Pulled k8s.gcr.io/coredns:1.2.6 |
Disable SWAP
> swapoff -va
> vi /etc/fstab
Code Block |
---|
# /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation UUID=e7b204f7-9f41-42d4-b55f-292990f4137a / ext4 errors=remount-ro 0 1 # swap was on /dev/sda5 during installation #UUID=9ca9f4cb-876e-4e23-91a4-2f543b5537ac none swap sw 0 0 kubelet kubeadm kubectlapt-mark hold kubelet kubeadm kubectl #disable swap swapoff -va #comment out the line for swap in the fstab file vi /etc/fstab #pull images kubeadm config images pull |
Now clone this VM with names:
...