CoreOS Linux introduced the Kubernetes Kubelet

Source: Internet
Author: User
Tags docker ps cadvisor

CoreOS Linux introduced the Kubernetes Kubelet

Kelsey Hightower

August 14, 2015

This week we have integrated a core embedded component of kubelet--kubernetes in the Alpha development of CoreOS Linux. Kubelet is responsible for maintaining the pod (application instance) collection. The Pod collection consists of one or more containers of the local system. In the Kubernetes cluster, Kubelet is used as a local agent to monitor the status of Podspecs by accessing the Kubernetes API server. Kubelet is also responsible for registering nodes to Kubernetes, sending events and pod status, and reporting resource utilization.

Kubelet plays an important role in the Kubernetes cluster and can also work in stand-alone mode. This article will focus on the techniques of using kubelet under a node in stand-alone mode that runs Kubernetes clusters, and how to use Kubelet to monitor container resource utilization with cadvisor built-in tools.

First we need to install the Kubelet and run them. Please use this guide in CoreOS Linux 773.1.0 or later.

Configuring Kubelet with Systemd

CoreOS Linux is logically integrated with Kubelet and is optimized for security and ease of use. But we will be easing security restrictions to support premium containers. This requires running the agent component on a single-node Kubernetes, which requires iptables operation permissions to facilitate configuration of the Kubernetes service discovery model.

Create Kubelet systemd (System Management Daemon) unit
sudo vim/etc/systemd/system/kubelet.service
[Unit]description=Kubernetes kubeletdocumentation=https://github.com/kubernetes/kubernetes[Service]execstartpre=/usr/bin/mkdir-p/etc/kubernetes/Manifestsexecstart=/usr/bin/Kubelet--api-servers=http://127.0.0.1:8080 \--allow-privileged=true   --config=/etc/kubernetes/manifests--v=2Restart=on-failurerestartsec=5[Install]wantedby=multi-User.target
Start the Kubelet service

After you have placed the SYSTEMD unit file, start the Kubelet with the Systemctl command.

sudo systemctl daemon-reloadsudo systemctl start Kubelet

To ensure that the Kubelet can boot from the boot, the service needs to be activated:

sudo systemctl enable Kubelet

At this time Kubelet service should have run up. You can use the Systemctl status command to confirm:

sudo systemctl status Kubelet
Start a single-node Kubernetes cluster

The Kubelet provides a convenient interface for the local System Management container. Kubelet provides a list (manifest) dictionary that is monitored every 20 seconds to update the pod's manifest file. Prior to this, the-CONFIG flag, the configuration file directory/etc/kubernetes/manifests, was required in the Kubelet systemd unit.

The Pod manifest file is formatted with a JSON or YAML file and describes a collection of file volumes and one or more containers. We can deploy a single-node kubernets 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 can be a potential security risk, so be sure to check the contents of all pod manifest before using them.

Cat Kubernetes.yaml

At this point we only need to copy Kubernetes.yaml this pod manifest to Kubelet's manifest directory to start a single node cluster.

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

After the copy is complete, you can see the Docker image and container launch using the standard Docker command line tool:

sudo docker images sudo docker PS

In a few minutes you'll have a running Kubernetes cluster. Next download the official Kubernetes Client tool.

Download Kubernetes Client

Kubectl is an official command-line tool for interacting with Kubernetes clusters. Each Kubernetes release contains a new version of Kublet. Download and change it to an executable program:

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

The kubectl can be used to obtain running cluster information.

./kubectl Cluster-info

Kubernetes Master runs on http://localhost:8080

Kubectl can also be used to start pods

./kubectl Run Nginx--image=nginx

View the running pods with the get PODS command:

./kubectl Get Pods

For more kubernets details, please scroll through Kubernetes on CoreOS docs.

monitoring containers with Cadvisor

The Kubelet has a built-in package of Cadvisor, which collects, aggregates, processes, and exports information for a given system's running container. The cadvisor contains a built-in web interface that can be accessed via 4194 ports.

cadvisor Web Interface .

The Cadvisor Web UI makes it easy to see the status of system resource utilization and processing lists.

System utilization information.

Cadvisor can also be used to monitor special containers, such as Kube-apiserver running in the Kubernetes pod:

with Cadvisor Viewing container information .

To learn more about Cadvisor, please read upstream docs.

More information on CoreOS and kubernetes

The integration of Kubelet in CoreOS Linux images demonstrates our commitment to (support) Kubernetes and the determination to bring the best open source container technology to our users. Native support for Kubernetes Kubelet, we want to improve the deployment efficiency of Kubernetes and provide a robust interface to manage and monitor containers on CoreOS systems.

If you are interested in Kubernetes, be sure to attend some training in the upcoming Kubernetes in your city. More arrangements will be put on the agenda and review the records. If you want a private online training, please contact us.

CoreOS Linux introduced the Kubernetes Kubelet

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.