How to install Minikube on Azure Linux VM - ubuntu 18.04 - azure

I want to install Minikube on Azure Linux VM - ubuntu 18.04. But couldn't find the appropriate article. So I would like to the appropriate steps, how to install Minikube on Azure Linux VM and work.

Pré-Requisites before create your VM on Azure:
It’s necessary a machine with nested virtualization. The CPU family with suffix _v3 gives this support, ex: Standard D2s v3, Standard D4s v3.
Standard D2s v3 is a good choice to start
I am using: Linux (ubuntu 18.04)
Login to VM using putty:
Installing Docker
$ curl -fsSL https://get.docker.com | sh
Installing VirtualBox
$ sudo apt install virtualbox virtualbox-ext-pack
Installing Minikube
Updating the system:
$ sudo apt update -y
$ sudo apt upgrade -y
To install the latest minikube stable release on x86–64 Linux using binary download:
$ sudo apt install -y curl wget apt-transport-https
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube
Installing Kubectl
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
$ kubectl version --client
Start Minikube
$ minikube start
Check Status
$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured
Get Nodes
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 64s v1.25.0
Addons
Only a few addons are enabled by default during the installation but you can turn on
$ minikube addons list
---To activate, run:
$ minikube addons enable <addon-name>
Running the First Deployment
$ kubectl create deployment my-nginx --image=nginx
$ kubectl get deployments.apps my-nginx
$ kubectl get pods

Related

docker service is not enabled - Kubernetes

I'm trying to install Kubernetes on an EC2 instance running Ubuntu 20.04.
I ran the following commands to install Kubeadm and Docker.
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo snap install docker
sudo kubeadm init
When I try to run Kubeadm init in order to initialize my Kubernetes control node, I get the following error:
[init] Using Kubernetes version: v1.23.4
[preflight] Running pre-flight checks
[WARNING Service-Docker]: docker service is not enabled, please run 'systemctl enable docker.service'
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR Service-Docker]: docker service is not active, please run 'systemctl start docker.service'
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
I subsequently checked to see if Docker was properly installed and pulled an Ubuntu 20.04 docker image and successfully ran it in interactive mode. So, I'm sure that Docker is running.
Does anyone have an idea as to what might be the issue?
My Kubeadm version is:
kubeadm version: &version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.4", GitCommit:"e6c093d87ea4cbb530a7b2ae91e54c0842d8308a", GitTreeState:"clean", BuildDate:"2022-02-16T12:36:57Z", GoVersion:"go1.17.7", Compiler:"gc", Platform:"linux/amd64"}
My Docker version is:
Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2
The issue was that I installed docker using snap.
This creates a service name that seems to cause issues with Kubernetes.
Install docker for Ubuntu 20.04 using directions on the official Docker website with apt-get. This seems to work.

Jenkins installation on Ubuntu using Vagrant - NO HTTP access

I've been trying to install Jenkins on ubuntu using Vagrant. Even though I am not getting any errors along the way I am not able to open http://localhost:8080
Here's my steps:
Install Vagrant and Virtual Box on MAC
Create a folder for the vagrant
vagrant init bento/ubuntu-16.04
nano Vagrantfile - delete the hasztag from the port forwarding to 8080
Vagrant up
Vagrant ssh
Install git:
Sudo apt-get install git
Git --version
Installing Java:
sudo apt update
Sudo apt-get upgrade
sudo apt install default-jdk
sudo apt install default-jre
Install Jenkins:
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get install -y jenkins --allow-unauthenticated
To check the password: vi /var/log/jenkins/jenkins.log
To start Jenkins: systemctl start jenkins
systemctl status jenkins
When I start the jenkins server I can do telnet 127.0.0.1 8080 but when I turn it off it doesn't work. Any idea why I cannot access GUI using the browser?
Try in ubuntu to do "curl http://localhost:8080" , if response is not some error code page, like 4xx/5xx, check firewall and allow traffic on port 8080. Therefore try to access Jenkins from Host Machine.
Make sure you don't have a service running on port 8080 on your guest machine.

Install microk8s via snap using Ansible, on WSL 2

I'm trying to install microk8s, using Ansible.
I get the error : "No snap matching 'microk8s' available"
I'm using WSL 2 (Ubuntu 20.04), and snap version 2.44.3+20.04.
My configuration:
- name: Install microk8s
snap:
name:
- microk8s
classic: yes
become: true
Does anyone know how to fix this?
On the WSL terminal, what happens if you type: snap version.
It seems that snap is broken on WSL2 and using Ubuntu 20.04.
You could try to:
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
It could also be a network/firewall issue. What happens if you try to install other packages.

How to update minikube latest version?

When I command minikube status it shows but with a GitHub link says that update minikube. Can you tell me how can I do this in a simple way?
$ minikube status
⚠️ There is a newer version of minikube available (v1.3.1). Download it here:
https://github.com/kubernetes/minikube/releases/tag/v1.3.1
To disable this notification, run the following:
minikube config set WantUpdateNotification false
host: Stopped
kubelet:
apiserver:
kubectl:
The script below removes everything (pods, services, secrets, etc.) that are found in Minikube, deletes old Minikube file, install latest Minikube file and then enables ingress and dashboard addons.
#! /bin/sh
# Minikube update script file
minikube delete && \
sudo rm -rf /usr/local/bin/minikube && \
sudo curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && \
sudo chmod +x minikube && \
sudo cp minikube /usr/local/bin/ && \
sudo rm minikube && \
minikube start &&\
# Enabling addons: ingress, dashboard
minikube addons enable ingress && \
minikube addons enable dashboard && \
minikube addons enable metrics-server && \
# Showing enabled addons
echo '\n\n\033[4;33m Enabled Addons \033[0m' && \
minikube addons list | grep STATUS && minikube addons list | grep enabled && \
# Showing current status of Minikube
echo '\n\n\033[4;33m Current status of Minikube \033[0m' && minikube status
(To make use of dashboard addons, execute the command of minikube dashboard on the terminal)
Sample terminal output after script run:
While updating for my Ubuntu 18.04 I did following
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb
minikube version # to check the version
minikube start # start minikube
minikube addons list # then check addons
For linux it saves it states at home .minikube directory so no need to delete previous minikube and then enabling addons it will automatically pick the addons and enable once it read states from .minikube directory.
$ sudo minikube delete
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.3.1/minikube-linux-amd64 && chmod +x minikube && sudo cp minikube /usr/local/bin/ && rm minikube
$ sudo minikube start --vm-driver=none
For those running mk on windows, follow these steps : (you will get the latest version of mk)
1: minikube stop
2: choco upgrade minikube
3: visit https://github.com/kubernetes/minikube/releases --> see latest version of kubernetes supported.
4: minikube start --kubernetes-version=1.xx.x
5: choco upgrade kubernetes-cli
6: kubectl version : to verify the update
I had the same issue. I found running minikube delete doesn't actually delete binary /usr/local/bin/minikube. Either delete it manually or you need to copy latest minikube into /usr/local/bin manually

Installing Docker.io on Ubuntu 14.04LTS

I'm running a virtual machine in Windows Azure with the prebuild image for Ubuntu 14.04 LTS.
When I want to install Docker.io like described here:
http://blog.docker.io/2014/04/docker-in-ubuntu-ubuntu-in-docker/
The installation works but when i`m running:
sudo docker.io pull ubuntu
An error will be thrown:
Cannot connect to the Docker daemon. Is docker -d running on this host?
Can anyone help or has the similar problem?
P.S.: Can anyone with a high reputation create a Tag for Ubuntu-14.04?
Evidently the docker daemon is not running. You wanna check /etc/default/docker.conf for proper configuration and issue
sudo service docker.io start
or
sudo service docker start
depending on how they called the service
Adding myself to the docker group:
sudo usermod -a -G docker myuser
and rebooting the machine worked for me. This solution is discussed in: https://github.com/docker/docker/issues/5314
On Ubuntu 14.04, the docker.io package installs Docker 0.9.1.
According to the documentation, to install the current version use these commands:
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
$ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker
There is also a simple script available to help with this process:
$ curl -s https://get.docker.io/ubuntu/ | sudo sh
Alternatively, check the azure-docker-registry project for an example of how to automate Azure provisioning and Docker container deployment. For instance, this Ansible playbook:
- name: create docker data directory
file: path=/mnt/data/docker state=directory
- name: store docker files in data disk
file: src=/mnt/data/docker dest=/var/lib/docker state=link
- name: add repository key
command: creates=/etc/apt/sources.list.d/docker.list apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
- name: copy repository source file
copy: src=docker.list dest=/etc/apt/sources.list.d/docker.list
- name: install docker package
apt: name=lxc-docker update_cache=yes state=present
Also make sure to symlink the docker.io binary to docker to use the tutorials/documentation without rewriting every command.
ln -s /usr/bin/docker.io /usr/bin/docker
Run docker -d to see if it shows any error messages.
If apparmor is missing install it with sudo apt-get install apparmor
Then sudo service docker start
Hard to say but sometime official docker installation procedure fails on Ubuntu 14.04.
One can simply install docker using below given commands [Quick and Dirty]
sudo apt-get update
sudo apt-get -y install docker.io

Resources