Is there a way to run Kubernetes minikube on a RHEL VM (Hypervisor)? Or is there any other way to try out Kubernetes with a single VM?
To run minikube on a RHEL CentOS VM, you need to install docker and virtualbox, before installing minikube and kubectl. Since minikube runs in a VM also, you be using nested virtualization, so you need to ensure that virtualization is enabled in the BIOS of your RHEL CentOS VM.
Once your VM is up and running, SSH in as root and run the following:
# Install docker dependencies
yum install -y yum-utils device-mapper-persistent-data lvm2
# Add Docker repo
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce epel-release wget
cd /etc/yum.repos.d/
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
yum update
Reboot your VM here and ensure that virtualization is enabled in the BIOS
# Install EPEL repo, Minikube kubectl etc.
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum --enablerepo=epel install dkms
yum groupinstall "Development Tools"
yum install -y kernel-devel VirtualBox-5.2
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.23.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
sudo /sbin/vboxconfig
# Start the minikube cluster
minikube start --vm-driver=virtualbox SERVICE_CLUSTER_IP_RANGE="X.X.X.X/24" --container-runtime=docker --extra-config kubelet.EnableCustomMetrics=true
# Start the dashboard
minikube dashboard
The minikube dashboard should be running and accessible at http://192.168.99.100:30000
Related
A.ON MASTER AND WORKER BOTH
Install and enable container
i. sudo apt-get update
ii. sudo apt-get install docker.io
install and enable k8s runtime
i. sudo apt-get update
ii. sudo apt-get install -y apt-transport-https ca-certificates curl
iii. sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
iv. 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
v. sudo apt-get update
vi. sudo apt-get install -y kubelet kubeadm kubectl
vii. sudo apt-mark hold kubelet kubeadm kubectl
B.ON MASTER ONLY
(RUN AS A ROOT) Initiate API server
i. kubeadm init --apiserver-advertise-address= --pod-network-cidr=192.168.0.0/16 enter image description here
In screenshot shared it has successfully bootstrapped master. As non root user you can create .kube and apply the network. It has given the join command which can be used in worker nodes to join them in k8s cluster.
I was trying to install MongoDB in WSL running Ubuntu 18.04 after seeing this documentation. But MongoDB says that:
IMPORTANTThe mongodb package provided by Ubuntu is not maintained by MongoDB Inc. and conflicts with the official mongodb-org package. If you have already installed the mongodb package on your Ubuntu system, you must first uninstall the mongodb package before proceeding with these instructions.
MongoDB also says that WSL doesn't support mongodb-org
WINDOWS SUBSYSTEM FOR LINUX (WSL) - UNSUPPORTEDMongoDB does not support the Windows Subsystem for Linux (WSL).
So, I installed mongod using sudo apt install mongodb and when I ran mongo it shows the error:
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-06-21T13:33:40.606+0530 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017
Is there is a way to install the appropriate package and make it running?
I have come across this situation recently.
Even though MongoDB says that it is not supported in WSL, you can actually install it. So, I suggest you follow that steps given in MongoDB docs.
Note : If you have already installed mongodb please remove all those before you install mongodb-org since it may cause some issues during installation :
sudo dpkg --remove --force-remove-reinstreq mongo-tools
sudo dpkg --remove --force-remove-reinstreq mongodb-server-core
sudo apt-get --fix-broken install
For installing mongodb community edition, I have added the commands below:
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
Now, to get mongoDB running,
sudo nano /etc/init.d/mongod
and paste the contents in this link into the file and save it.
#give permissions
sudo chmod +x /etc/init.d/mongod
#start the service
sudo service mongod start
Now, you can run mongo to reach the database.
Hope it helps.
#bonyem's solution works if you try on Ubuntu 18.04 (and apparently in 19.10) but not in 20.04. WSL version should be 2 (please see this to update WSL).
You also need to "fake" the bash binary by following the steps mentioned in https://github.com/shayne/wsl2-hacks to make systemctl work.
I tried all the methods above but none of the methods worked. I came across Microsoft's official documentation and everything works like a charm.
https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database#install-mongodb
This worked for me.
Run sudo apt install mongodb
Then after that installs run sudo service mongodb start
It will say * Starting database mongodb
And after that I can connect using mongo
Easiest way to bypass this issue is to run MongoDB on Windows. You'll still be able to connect from WSL2 over localhost.
For me, #bonyem's solution resulted in an error:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
I'm going to install Mongo 4.4. Many instructions were taken from #Lyubosumaz's directions here.
Get rid of all your Mongo PPAs.
~ ❯ sudo ls /etc/apt/sources.list.d
mongodb-org-4.4.list yarn.list
~ ❯ sudo rm -i /etc/apt/sources.list.d/mongodb-org-4.4.list
Remove all Mongo packages and bits and pieces.
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
sudo dpkg --remove --force-remove-reinstreq mongo-tools
sudo dpkg --remove --force-remove-reinstreq mongodb-org
sudo dpkg --remove --force-remove-reinstreq mongodb-org-server
sudo dpkg --remove --force-remove-reinstreq mongodb-server-core
sudo dpkg --remove --force-remove-reinstreq mongodb-org-mongos
sudo dpkg --remove --force-remove-reinstreq mongodb-org-shell
sudo dpkg --remove --force-remove-reinstreq mongodb-org-tools
sudo apt-get --fix-broken install
yes | sudo apt autoremove
Add new PPA and install Mongo 4.4.
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y mongodb-org
You'll get the same error from before. This is caused by mongodb-org package trying to use systemctl to start the DB after install (source). Notice that the same error is thrown when running the command manually.
~ ❯ sudo systemctl start mongod
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
However, running mongod should still work!
If you run into errors when running mongod, you might need to modify some permissions and create a data directory. I found the answer to these issues here, here, and here.
sudo chown $USER /tmp/mongodb-27017.sock
sudo mkdir -p /data/db
sudo chown -R $USER /data/db
I have tried some of the answers above, it did not work for me.
Then I followed a guide 1:
Update ubuntu packages
Install MongoDB on the command line
Set up your local database
Creating the folders and permissions
It worked in my case!
I used below mentioned commands to remove kubernetes from my ubuntu 18.04 server.
kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*
sudo apt-get autoremove
sudo rm -rf ~/.kube
but still its showing :
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server `localhost:8080 was refused - did you specify the right host or port? while running kubectl version .
How can i completely remove kubectl from my ubuntu server 18.04 ?
Depending on the method you chose in https://kubernetes.io/docs/tasks/tools/install-kubectl/, it can be any of these:
Install kubectl binary via curl: sudo rm /usr/local/bin/kubectl
Download as part of the Google Cloud SDK: gcloud components remove kubectl
Install with snap on Ubuntu (just as Gparmar said): snap remove kubectl
In addition, you may need to remove the configuration files in ~/.kube.
If you exectute commands below:
kubeadm reset
sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*
sudo apt-get autoremove
sudo rm -rf ~/.kube
remember to restart computer.
I am trying to setup minikube on my mac machine
Below are environment:
nhs-MBP:~ anhtrang$ minikube version
minikube version: v0.26.1
anhs-MBP:~ anhtrang$ echo "";
anhs-MBP:~ anhtrang$ echo "OS:";
OS:
anhs-MBP:~ anhtrang$ cat /etc/os-release
cat: /etc/os-release: No such file or directory
anhs-MBP:~ anhtrang$ echo "";
anhs-MBP:~ anhtrang$ echo "VM driver":
VM driver:
anhs-MBP:~ anhtrang$ grep DriverName ~/.minikube/machines/minikube/config.json
"DriverName": "virtualbox",
anhs-MBP:~ anhtrang$ echo "";
anhs-MBP:~ anhtrang$ echo "ISO version";
ISO version
anhs-MBP:~ anhtrang$ grep -i ISO ~/.minikube/machines/minikube/config.json
"Boot2DockerURL": "file:///Users/anhtrang/.minikube/cache/iso/minikube-v0.26.0.iso",
Got following error:
nhs-MBP:~ anhtrang$ Starting local Kubernetes v1.10.0 cluster...
-bash: Starting: command not found
anhs-MBP:~ anhtrang$ Starting VM...
-bash: Starting: command not found
anhs-MBP:~ anhtrang$ E0420 08:24:57.963653 81977 start.go:159] Error starting host: Temporary Error: Error configuring auth on host: OS type not recognized.
Please advise
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.
Let’s start with some pre-installation checks:
do you have Docker containers installed? Please check it by executing the below command:
docker version
If it’s not installed or is outdated - Docker installation guide will help you:
https://docs.docker.com/docker-for-mac/install/
do you have any of the supported virtualization software installed?
At this moment, minikube can use these virtualization solutions to spin up all-in-one cluster:
xhyve
VirtualBox
hyperkit
In this installation, we use hyperkit, because xhyve is deprecated. You can choose
VirtualBox as well, but I will not describe it here and focus on hyperkit.
Paste the following command in a terminal window:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.26.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
next install hyperkit:
curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-hyperkit \
&& chmod +x docker-machine-driver-hyperkit \
&& sudo mv docker-machine-driver-hyperkit /usr/local/bin/ \
&& sudo chown root:wheel /usr/local/bin/docker-machine-driver-hyperkit \
&& sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit
At this point, please consider removing failed minikube installation :
minikube delete
Now you are ready to get started with minikube!
minikube --vm-driver=hyperkit start
After a while, the cluster is started, and you can use it by the command:
kubectl
minikube delete and start will solve the issues
minikube delete
minikube start
for unavoidable situations, try uninstall and re-install minikube
brew cask uninstall minikube
brew cask install minikube
Try using below commands for installing minikube on mac
brew install minikube
brew link minikube
I have installed PostgreSQL 9.6.1 on a remote Debian 8.1 minimal VM. I am attempting to install pgAdmin4 in server mode so that I am able to access remotely via the web. I have successfully installed pgAdmin4 within a python virtual environment, but an issue arises at one of the final steps of configuration:
Starting pgAdmin 4. Please navigate to http://localhost:5050 in your browser.
Since I do not have a desktop environment installed (nor do I intend on installing one), how can I complete configuration without using localhost? I have attempted to connect using the server's public IP (e.g. http://80.254.0.132:5050) but am not able to resolve.
I do not have a firewall at the VM or server/NAT level.
I have updated /etc/postgresql/9.6/main/pg_hba.conf and added host all all 0.0.0.0/0 md5 to the configuration.
I have updated /etc/postgresql/9.6/main/postgresql.conf and changed listen_addresses = '*'.
My full steps involved in post-Debian installation (sans new users) looks like the following:
# Initial update.
apt-get install sudo
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y
sudo apt-get install vim -y
# Postgres.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
# Install PostgreSQL.
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib libpq-dev python-dev
# Set postgres password.
sudo -s
cd ~
sudo -u postgres psql postgres
\password postgres
# Allow remote connections.
sudo vim /etc/postgresql/9.6/main/pg_hba.conf
# host all all 0.0.0.0/0 md5
sudo vim /etc/postgresql/9.6/main/postgresql.conf
# listen_addresses = '*'
sudo service postgresql restart
# Python and pgAdmin.
sudo easy_install pip
sudo pip install virtualenvwrapper
# Create the virtual environment and install pgAdmin.
virtualenv pgadmin4
cd pgadmin4
source bin/activate
sudo apt-get install build-essential libssl-dev libffi-dev python-dev libgmp3-dev
sudo pip install cryptography pyopenssl ndg-httpsclient pyasn1
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/pip/pgadmin4-1.1-py2-none-any.whl
pip install pgadmin4-1.1-py2-none-any.whl
cp ./lib/python2.7/site-packages/pgadmin4/config.py ./lib/python2.7/site-packages/pgadmin4/config_local.py
python ./lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
By default pgAdmin4 runs on loopback adapter, to make it run on ethernet (eth0) you need to change some of configuration options.
You need to add below config options,
DEFAULT_SERVER = '0.0.0.0'
in config_local.py (in "pgAdmin4" folder).
If also want to change default port then also add
DEFAULT_SERVER_PORT = 8081
Now restart pgAdmin4, Now try accessing pgAdmin4 using IP address you mentioned(eg, http://80.254.0.132:8081), It should work.