Page cover image

Register minikube

Steps to register minikube Cluster in gopaddle

minikube cluster can be registered in gopaddle either using its public IP address or a fully qualified domain name (FQDN) or securely via a Bastion Host or a Jump server.

1. Port Configuration

In the steps to follow, we will be configuring Nginx server to proxy the requests to the Cluster API server. Make sure port the Nginx server port (default 80) is open to public.

2. Set up Nginx Proxy

  1. Install Python3 and Pip, if not already installed.

sudo apt install python3 -y
sudo apt install python3-pip -y
python3 --version
  1. Install pyyaml dependency

pip install pyyaml
  1. Make a temporary directory to download the scripts

export TMP_DIR=$HOME/gp_temp/
mkdir -p $TMP_DIR
  1. Download the script to extract and expand the CA Certificate, Client Certificate and Key data in the Kubernetes configuration.

curl -o $TMP_DIR/
chmod +x $TMP_DIR/
  1. Install kubectl command line tool, if not installed already.

sudo snap install kubectl --classic
  1. Install yq tool to filter Kubernetes YAML file contents.

sudo snap install yq
  1. Run the replace script to extract and expand the CA Certificate, Client Certificate and Key data in the Kubernetes configuration

  1. Download the script to extract the API server URL, CA Authority, Client certificate and key data from the default Kubernetes Configuration file.

curl -o $TMP_DIR/
chmod +x $TMP_DIR/
  1. Verify if the extraction script works as expected.

python3 $TMP_DIR/ API_SERVER_URL --tmp-dir $TMP_DIR

The output of this execution must result in a similar output like this - Eg output. Note that the ports might differ based on the cluster configuration.

  1. Install Nginx and set HTTP basic authentication for the user named minikube.

sudo apt-get install apache2-utils -y
sudo mkdir /etc/nginx/
sudo htpasswd -c /etc/nginx/.htpasswd minikube
  1. Download the scripts to prepare the Nginx configuration and SSL certificate files

curl -o $TMP_DIR/
chmod +x $TMP_DIR/
  1. Prepare the Nginx configuration and SSL certificate files

sudo mkdir /etc/nginx/certs
sudo mkdir /etc/nginx/conf.d
sudo sh $TMP_DIR/  $TMP_DIR
  1. Install docker, if not already installed. Check the steps here to install docker.

  2. Run Nginx container with the configuration and SSL certificate files.

sudo docker run -d --name nginx  --network host -v /etc/nginx/conf.d/:/etc/nginx/conf.d -v /etc/nginx/.htpasswd:/etc/nginx/.htpasswd -v /etc/nginx/certs/cluster.cert:/etc/nginx/certs/cluster.cert -v /etc/nginx/certs/cluster.key:/etc/nginx/certs/cluster.key nginx
  1. Check if Nginx proxy works (skip this step for bastion host setup)

Open a browser session with the public IP address or the FQDN of the cluster master node. Eg. http://<public_ip>

This must show a popup for authentication. Enter the Username as kind and password set in step 6.

  1. Copy the kube.config file to your local desktop environment

cat $TMP_DIR/kube.config

3. Validate Connection from Local Desktop Environment

  1. Edit the kube.config and replace the server with the Nginx endpoint with basic authentication like this - http://<httpd_user>:<http_password>@<public-ip_or_fqdn>

    Based our Nginx configuration in this example, the protocol must be http and not https

apiVersion: v1
- cluster:
    certificate-authority-data: <cert-auth-data>
    server: http://minikube:<http_passwd>@<public-ip_or_fqdn>
  name: minikube
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
- name: minikube
    client-certificate-data: <client-cert-data>
    client-key-data: <client-key-data>
  1. Verify if kube configuration works.

export KUBECONFIG=$(pwd)/kube.config
kubectl get ns
  1. Use this kube.config file to register the cluster in gopaddle.

4. Register the Cluster in gopaddle

  1. In the gopaddle UI, navigate to the Clusters section

  2. Click on Add a Cluster and select Register an existing Cluster

  3. In the Cluster registration wizard, select the Cluster Access Method as Kube Config

  4. Choose the Cluster Provider type as Other

  5. In the Authentication Step, upload the Kubernetes config file gathered under section "Validate Connection from Local Desktop Environment".

  1. If you have configured a bastion host, provide the Bastion Host IP, SSH Pem file, SSH port

If you are using a Bastion Host setup, make sure the Bastion Host IP and Port are accessible publicly. If you are looking for a private only setup, get in touch with us to explore gopaddle Enterprises.

  1. Click on Finish to register the On-premises Cluster.

  2. If you see the error - Network Error ! ServerError: Response not successful: Received status code 503, while view the cluster resources, then check this troubleshooting section for more information.

Last updated