CoreOS integrates Kubernetes Core Component Kubelet

Source: Internet
Author: User
Tags cadvisor

CoreOS integrates Kubernetes Core Component Kubelet

[Editor's note] This article introduces the integration and support of Kubernetes's Core Component kubelet in CoreOS, a news and description published by the official CoreOS blog. Installing and using Kubelet in CoreOS demonstrates Kubelet's usage skills and how to better manage and monitor container resources in Kubernetes.

This week, we integrated a core embedded component of kubelet-Kubernetes in the alpha development version of CoreOS Linux. Kubelet is responsible for maintaining the pod (application instance) set. A Pod set consists of one or more containers in the local system. In a Kubernetes cluster, kubelet acts as a local proxy to access the Kubernetes API server and monitor the PodSpecs status. Kubelet is also responsible for registering nodes to Kubernetes, sending events and pod status, reporting resource utilization.

Kubelet plays a very important role in the Kubernetes cluster, but it can also work in standalone mode. This article will focus on the Kubelet running in standalone mode, such as running a single-node Kubernetes cluster, and using the cAdvisor built-in tools to monitor container resource utilization.

First, we need to install kubelet and run it. Use this guide in CoreOS Linux 773.1.0 or later.

Use systemd to configure Kubelet

CoreOS Linux integrates kubelet by default, and implements Security optimization and usability optimization. However, security restrictions will be relaxed to support advanced containers. This requires running the Proxy component on a single-node Kubernetes. This component requires the operation permission of iptables to facilitate the configuration of the service discovery model of Kubernetes.

Create a kubelet systemd (System Management Daemon) Unit
sudo vim /etc/systemd/system/kubelet.service

 

[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/kubernetes/kubernetes

[Service]
ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests
ExecStart=/usr/bin/kubelet \
--api-servers=http://127.0.0.1:8080 \
--allow-privileged=true \
--config=/etc/kubernetes/manifests \
--v=2
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

 

Start the kubelet Service

After the systemd unit file is configured, usesystemctlCommand to start Kubelet:

sudo systemctl daemon-reload
sudo systemctl start kubelet


To ensure that kubelet can start automatically, You need to activate the service:

sudo systemctl enable kubelet


Now the kubelet service is running. You can usesystemctlSTATUS command confirmation:

sudo systemctl status kubelet

 

Start a single-node Kubernetes Cluster

Kubelet provides a very convenient interface to manage containers. Kubelet has a manifest dictionary, which is monitored every 20 seconds by default to update the manifest file of the pod. Before that, you must use--configIndicates the configuration file directory/etc/kubernetes/manifests.

The Pod manifest file is formatted with a JSON or YAML file and describes file volumes and one or more containers. We can deploy a single-node Kubernetes cluster using a pod manifest in the manifest directory.

Download Kubernetes pod manifest
wget https://raw.githubusercontent.com/coreos/pods/master/kubernetes.yaml


Downloading pod manifest on the Internet poses a security risk. Therefore, check the content of all pod manifest before using them.

cat kubernetes.yaml


Now we only need to copykubernetes.yamlThis pod manifest is directed to the manifest directory of kubelet to start a single-node cluster.

sudo cp kubernetes.yaml /etc/kubernetes/manifests/


After copying, you can use the standard Docker command line tool to view the Docker image and container startup:

sudo docker images sudo docker ps


A few minutes later, the Kubernetes cluster will be ready to run. Next, you can download the official Kubernetes client tool.

Download the Kubernetes Client

kubectlIs an official command line tool for interacting with Kubernetes clusters. Each Kubernetes release contains a new kublet version. Download and change it to an executable program:

wget https://storage.googleapis.com/kubernetes-release/release/v1.0.3/bin/linux/amd64/kubectl
chmod +x kubectl


Kubectl can be used to obtain information about running clusters.

./kubectl cluster-info


The Kubernetes master runs at http: // localhost: 8080.
kubectlIt can also be used to start pods.

./kubectl run nginx --image=nginx


Useget podsCommand to view the running pods:

./kubectl get pods


For more details about Kubernetes, refer to Kubernetes on CoreOS docs.

Monitor containers with cAdvisor

Kubelet has a built-in cAdvisor for collecting, summarizing, processing, and exporting information about running containers of a given system. The cAdvisor contains a built-in web interface that can be accessed through port 4194.

[Cadvisor web interface]


The cAdvisor web UI allows you to conveniently view the utilization status and processing list of system resources.

[System Utilization diagram]


The cAdvisor can also be used to monitor special containers, such as kube-apiserver running in the Kubernetes pod:

[Use cadvisor to view container Information]


For more information about cAdvisor, refer to upstream docs.

More information about CoreOS and Kubernetes

The integration of kubelet in CoreOS Linux images demonstrates our commitment to (supporting) Kubernetes and our determination to bring the best open source container technology to our users ). Native supports Kubernetes kubelet. We hope to improve the deployment efficiency of Kubernetes and provide robust interfaces to manage and monitor containers on CoreOS.

For more CoreOS tutorials, see the following:

How to deploy a WordPress instance in CoreOS

Initial server operating system CoreOS experience

CoreOS practice: Analyzing etcd

CoreOS practice: Introduction to CoreOS and management tools

[Tutorial] Build your first application on CoreOS

Quick Start of CoreOS installation on PC

Build a private repository using register images in CoreOS

CoreOS details: click here
CoreOS: click here



Original article: Introducing the Kubernetes kubelet in CoreOS Linux)

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.