Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to manage Google GKE, AWS EKS and Oracle OKE in a unified way

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Before the advent of Rancher, it was never easy to manage kubernetes clusters running in different cloud providers. What is Rancher? It is an open source Kubernetes management platform. Users can create Kubernetes clusters that connect different clouds on Rancher, or import existing Kubernetes clusters for unified management.

In this article, I will demonstrate how to start a Kubernetes cluster in the Google cloud, in AWS Cloud, and how to import a cluster from Oracle Cloud. All three clusters will eventually have an intuitive view on Rancher Dashboard and will be able to be managed in a unified manner. This article will show you step by step how to create a Kubernetes cluster from Rancher and how to easily monitor and deploy through Rancher Dashboard.

In addition to the Rancher Kubernetes management platform, Rancher Labs has also released its own RKE (Rancher Kubernetes Engine) for users to choose from. RKE this is a very simple, lightning fast Kubernetes installer that can be used anywhere. As a result, it eliminates the pain of installing Kubernetes clusters on bare metal servers or VM, and it also provides a lot of customization flexibility.

RKE installation

In this chapter I will demonstrate how to install a Rancher Kubernetes cluster on three VM. First you need three machines to start the RKE cluster. I used three EC2 instances and ubuntu18.04 as boot images. So now that I have a separate VM, I will perform all installations of the three nodes, one of which will be the master node and the other two will be the working node. I've installed it according to the official documentation (https://rancher.com/docs/rke/latest/en/installation/), and I've adjusted a few steps to make the whole job easier.

Step 1: download the RKE binaries

Wget

Https://github.com/rancher/rke/releases/download/v0.1.18/rke_linux-amd64

Step 2:mv rke_linux-amd64 rke

Step 3: export PATH = / home / cloud_user / rke:$ PATH

Step 4: so far, I have installed three ubuntu EC2 machines with docker installed (be sure to run "usermod-aG docker ubuntu" so that docker can be accessed by ubuntu users), and the private key files I used when creating these instances. All you need to do is create a file in the current VM, copy the contents of the key, change the key permissions, and try to log in to one of your EC2 instances.

Then run the following command:

Rke config-- name cluster.yml (if you haven't already set the path, you can use. / rke here).

Once you press enter, it will start asking you for some different parameter values, because it will create a cluster.yml file based on these parameter values. These parameters are basically the node characteristics you define, and rke will automatically create a cluster.yml for you. You can also create your own according to the Rancher documentation.

These are the parameters I passed and generated the cluster.yml file based on it. It's basically a three-node configuration and some of the other cluster-related configurations I choose by default.

This is what Node looks like in the cluster.yml file based on the parameters we passed. Now that you have the cluster.yml file ready, you can move on to the next step.

Step 5: run "rke up" to start the cluster (if you have cluster.yml files in the same location), or if you have files other than cluster.yml, you can run: rke up-- config abc.yml

It's as simple as that! Then you will see the cluster start up and start displaying various INFO logs to perform various tasks to start the cluster and connect the nodes together. This also allows you to see what's going on behind the scenes so that you can feel all the steps of cluster creation. If you don't need these, just take a look at our "successful establishment of a Kubernetes cluster".

After that, rke will also create a kubeconfig file that you can use to interact with the cluster (prior to installing kubectl), named "kube_config_cluster_yml". If you use a yml file with a different name, it will be 'kube_config_test_yml',' and then you can use this config file to interact with the cluster.

Rancher installation

Now I'll show you how to install Rancher and create / import a cluster from Rancher Dashboard. I will use the same VM I used for the RKE installation. I will run Rancher on port 80 as the docker container.

Command: docker run-d-- restart=unless-stopped-p 80:80-p 44315 rancher/rancher

Got it! Rancher is up and running now!

Now log in to Rancher and set the password, using URL.

Now that Rancher is up and running, we can prepare to create and import the cluster. Next I'll show you how to use Rancher to create AWS and Google cloud clusters and how to import clusters from the Oracle cloud and the recently created RKE.

Create an AWS cluster using Rancher

Step 1: click add Cluster and select Amazon EKS. Once selected, you will need to provide the cluster name, access key (Access Key), and secret Key.

Step 2: click configure Cluster, and then select the Kubernetes version and service role.

Step 3: click to select VPC and subnet to select the node's VPC and public IP.

Step 4: select the instance option to specify the shape and size of the node.

Step 5: create a cluster

After you click create, the configuration of the AWS EKS cluster begins, which will be displayed in the AWS dashboard and Rancher Dashboard.

Create a Google Kubernetes cluster using Rancher

Step 1: create a service account in the Google cloud console with the following permissions.

Step 2: create a JSON key for the service account and save it on your computer, as this key will be required when creating a cluster through Rancher.

Step 3: go to Rancher Dashboard, click add Cluster and select Google GKE. Fill in the name of the cluster and paste the JSON file of the service account you just created in step 2.

Step 4: after clicking "configure Node", it will authenticate using the provided JSON file and display the different parts of the two, where you can select the appropriate cluster option. You can select the region, Kubernetes version, number of nodes / shape / mirror, enable / disable automatic repair, automatic scaling and automatic upgrade, and then click "create".

That's it, as long as you click "create", the Google Kubernetes cluster will be created.

Import a RKE cluster using Rancher

In this section, I'll show you how to import a RKE cluster into the Rancher you just created at the beginning of this article.

Step 1: click add Cluster, select the import option, fill in the cluster name and click create.

Step 2: run the commands mentioned on the next screen to create the cluster administrator role and the yaml required for the Rancher import.

Import the Oracle Kubernetes engine into Rancher Dashboard

First create an OKE (Oracle Kubernetes Engine), go to the Oracle OCI console, select developer Services from the menu, and then select Cluster. I will choose the quick create option because it is so simple that there is no need to do anything other than providing the cluster name and node shape and count.

Rancher Dashboard

Let's take a look at Rancher Dashboard.

Now, you can use Rancher Dashboard for a variety of different operations.

Enable monitorin

You can use Dashboard directly to enable prometheus and grafana monitoring and access the grafana dashboards of all clusters. Next I will show how to perform operations for Google Kubernetes clusters, and these processes apply to all other types of clusters.

Step 1: select the cluster for which you want to enable monitoring.

Step 2: select Monitor from the tools menu.

Step 3: click enable and set the limit. Click Save.

After clicking "Save", your monitoring function is enabled. When you click on the cluster, you will see the logo of grafana.

Click any Grafana logo and you will jump to the Grafana dashboard where you can view all metrics and create alerts as needed.

Manage the cluster

You can easily manage all deployed pod, services, etc., of the cluster using Rancher Dashboard.

Here, you can edit the yaml files, redeploy them, and change the configuration as needed.

Deploy the application

Deploying an application to a cluster using Rancher Dashboard is very simple. Simply open the workload page of the cluster to deploy the application.

Let's deploy a sample nginx application. When choosing deployment, you can use a variety of options to deploy the application.

You can set environment variables, execute node plans, run health checks, create volumes, and define extension policies. You can also do a lot of things through a single application deployment interface (cool! ). You can also expose the port (for my deployment, I have exposed it as an external load balancer).

Execute the kubectl command

You can execute the kubectl command through Rancher UI with the help of the kubectl shell generated when configuring the cluster. One problem here is that when you try to run kubectl shell multiple times, you will be disconnected due to some docker problems. Another possible way is to download the kubeconfig file and run the kubectl command locally.

You can also create volumes, create Pipeline for CI/CD, and so on.

Conclusion

In this article, I share:

How to install Rancher

How to install Google GKE using Rancher

RKE Settin

Create an AWS EKS using Rancher

Import Oracle Cloud OKE into Rancher

Enable monitoring of the cluster from Rancher

Deploy the sample application using Rancher UI and expose it as a load balancer

Use Rancher UI to execute Kubectl commands

Rancher has so many functions that I certainly can't share all the functions, features, and so on of Rancher in a single article. You can continue to explore more usage on your own.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report