Installation of Apinizer on Ubuntu OS
This document describes installing Kubernetes version 1.24.0 on a server with Ubuntu operating system. It is recommended to have Ubuntu 2022.04 LTS Operating system.
Pre-Installation Checks to be Performed Before Starting the Installation
Very Important
Before starting the installations, make sure to confirm from the system administrators that the servers are on the same network and on the same Virtual Machine.
Very Important
Before starting the installations, make sure that the hostname of the server is not localhost.localdomain and that each one is unique (with the hostname command). If this is the case, change it before starting the operations.
# (If necessary) Change Hostname
hostnamectl set-hostname your-new-hostname
There should be an input as 127.0.1.1 in /etc/hosts file.
There should be no "nameserver 127.0.1.1" entry in the /etc/resolv.conf file.
Very Important
If a proxy is required to access the internet, the following codes should be run.
# Run the following on the Linux shell:
export http_proxy=http://proxyIp:port/
export https_proxy=http://proxyIp:port/
export no_proxy=localhost,127.0.0.1,SERVERIP,*.hostname
# Add the codes below to the following files:
sudo vi /etc/apt/apt.conf
Acquire::http::Proxy "http://username:password@proxyIp:port";
Acquire::https::Proxy "https://username:password@proxyIp:port";
sudo vi /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxyIp:port"
Environment="HTTPS_PROXY=https://proxyIp:port"
Environment="NO_PROXY="localhost,127.0.0.1,::1,SERVERIP,*.hostname"
Important for Installation
In order for the installation to be healthy, Apinizer Kubernetes servers must access the following addresses.
To access Docker Images:
*.docker.com
*.docker.io
Kubernetes:
https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
Kubernetes Dashboard:
https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta4/aio/deploy/recommended.yaml
SSL Inspection must be turned off on the firewall for the addresses below.
k8s.gcr.io
registry-1.docker.io
hub.docker.com
If not all traffic between servers is to be allowed, permissions must be defined for the following ports individually:
6443/tcp # Kubernetes API server
2379-2380/tcp # etcd server client API
10250/tcp # Kubelet API
10251/tcp # kube-scheduler
10252/tcp # kube-controller-manager
8285/udp # Flannel
8472/udp # Flannel
30000-32767 #Applications on Kubernetes
Important
While updating the packages, Ubuntu tries to pull from the server located in Turkey. However, from time to time, there may be a problem at tr.archive.ubuntu.com. In this case, you need to make the following change.
sudo vi /etc/apt/sources.list
#Replace all addresses starting with .tr with "Replace All".
#Example:
#1) Operating System Configurations (All Servers)
POWERSHELL
|
#2) Kubernetes Installation
#2.1) Container Installation (Will be Done on All Kubernetes Servers)
POWERSHELL
YML
POWERSHELL
|
#2.2) Kubernetes Installation (On Master and Worker servers)
POWERSHELL
|
#2.2.1) Bash Auto-Completion (Optional, On Any Kubernetes Master Server)
This process can speed up the writing of Kubernetes commands:
POWERSHELL
|
#2.2.2) Creating Kubernetes Master Server(On Kubernetes Master Servers)
Run the following command to make Multi-Master Kubernetes:
POWERSHELL
Important If you will not use 10.244.0.0/16 as the IP block that the Kubernetes pods will take (podCIDR value), you need to edit the above command accordingly. To use the Multi-Master structure, the other nodes that will be Master should be connected with the following code
BASH
Very Important # If the connection command is to be re-created, the output of the second command below should be added to the first one:
# The result should look something like this:
# If the code is intended to be generated manually, the following is used: for XXX → for YYY → for ZZZ → |
#2.2.3) Setting User Configuration of kubectl Command on Kubernetes Master Server (On Kubernetes Master Servers)
Definitions are made for the user who will run the kubectl commands:
POWERSHELL
|
#2.2.4) Install Kubernetes Network Plugin (On Kubernetes Master Servers)
In this guide, we will use the Flannel network add-on. You can choose other supported network add-ons. Flannel is a simple and easy way to configure a layer 3 network architecture for Kubernetes.
POWERSHELL
Important If you did not use the value 10.244.0.0/16 as podCIDR while initializing the Master, you should download the above yaml file and edit the network settings here as well. |
#2.2.5) If the Master Server is Wanted to be Used as a Worker at the Same Time (Optional)
It is not recommended for production environments. To add the worker role to the Master
POWERSHELL
To remove the worker role from the Master
POWERSHELL
|
#2.2.6) Registering Kubernetes Worker Servers to the Master (On Kubernetes Worker Servers)
A token information is required to connect the worker server to the Master. This will be written down during the setup phase on the master node. But if it is missed or you want to view it again, the following command can be used.
On Master Node
POWERSHELL
Nodes that will be Workers on
BASH
|
#2.2.7) Installation Check (On Any Kubernetes Master Server )
If the Node created in addition to the Master can be seen when the following code is run on the Master, the installation has been completed successfully.
If it does not transition from NotReady to Ready status within two minutes, the problem should be investigated with the command 'kubectl describe node <MASTER_SERVER_HOSTNAME>'.
BASH
|
#2.3) DNS Test (Optional, On Any Kubernetes Master Server)
POWERSHELL
|