In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
About K3s
K3s is a lightweight Kubernetes release released by Rancher Labs, designed for R & D and operation personnel running Kubernetes in a resource-constrained environment.
It is a certified Kubernetes distribution with minimum system requirements as follows:
System kernel version: Linux 3.10 +
Minimum RAM requirement per Server: 512 MB
Minimum RAM per node: 75MB
Minimum disk space requirements: 200 MB
Supported hardware architectures: x86x64, ARMv7, ARM64
These low configuration requirements make K3s very suitable for IoT-related scenarios.
Create a project in GitLab
Before installing K3s, let's create a new project on Gitlab called api.
After the creation is complete, we click Operations in the side menu bar and select Kubernetes in the subordinate menu.
We now have two options:
Create a new Kubernetes cluster on GKE
Import the configuration of an existing Kubernetes cluster (no matter where the cluster is created)
Note: in the current version of GitLab, the creation of new clusters is limited to GKE.
We select the [Add existing cluster] tab.
In this step, we need to fill in several fields to provide the cluster configuration we need to integrate. Keep opening this tab and ignore it for the time being. Now, let's create a brand new Kubernetes cluster.
Create a K3s cluster
We will now start a Kubernetes cluster based on K3s. Why K3s? Because I want to show how easy it is to set it up. To make the steps clear at a glance, we set up a cluster of only one node.
I have configured a Ubuntu 18.04 server named node1, and after we have obtained a shell on this host, we only need to run the following command to install K3s, which is a certified Kubernetes cluster.
Root@node1:~ $curl-sfL https://get.k3s.io | sh-
The above command is similar to the command for quick Docker installation:
Curl https://get.docker.com | sh
After installation, you can find the configuration file that connects to the cluster in / etc/rancher/k3s/k3s.yaml.
Root@node1:~ $cat / etc/rancher/k3s/k3s.yamlapiVersion: v1clusterscat-cluster: certificate-authority-data: LS0tL...tCg== server: https://localhost:6443 name: defaultcontexts:- context: cluster: default user: default name: defaultcurrent-context: defaultkind: Configpreferences: {} users:- name: default user: password: 48f4b...4b4e7 username: admin
This configuration is automatically used by the local kubectl.
$kubectl get nodesNAME STATUS ROLES AGE VERSIONnode1 Ready master 3m v1.14.5-k3s.1
Note: as we saw in Quick Start (https://k3s.io/), adding additional nodes is not complicated, it basically only needs to get a token from / var/lib/rancher/k3s/server/node-token on the primary server and use the following command to connect to some other nodes:
$curl-sfL https://get.k3s.io | K3Selecurl = https://myserver:6443 K3S_TOKEN=XXX sh-Integration in Gitlab now let's get all the information we need to integrate the new K3s cluster in the Gitlab project.
Cluster name: K3s
URL for API Server: in the configuration file, API Server is specified as: https://localhost:6443. In order to access from the outside, we need to provide an IP address outside the node1.
Cluster CA certificate: to provide the cluster CA certificate to Gitlab, we need to decode the file specified in the configuration (just as it is in base64).
$kubectl config view-- raw\-- obsolete jsonpathpaths'{.cluster.certificate-authority-data}'\ | base64-- decode
Service token
The process of obtaining an identification token involves several steps. We first need to create a ServiceAccount and provide it with a cluster-admin role. The following command completes these steps:
$cat
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.