CoreOS Linux introduces Kubernetes kubelet
This article introduces the integration and support of Kubernetes Core Component kubelet in CoreOS. 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 have integrated a core embedded component of kubelet-Kubernetes in alpha development 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 is used as a local proxy to monitor the PodSpecs status by accessing the Kubernetes API server. Kubelet is also responsible for registering nodes to Kubernetes, sending events and pod status, reporting resource utilization.
Kubelet plays an important role in the Kubernetes cluster and can work in standalone mode. This article will focus on using Kubelet in standalone mode, that is, running Kubernetes clusters but nodes, and how to monitor container resource utilization using Kubelet using the built-in cAdvisor tools.
First, install and run kubelet. Use this guide in CoreOS Linux 773.1.0 or later.
Use systemd to configure Kubelet
CoreOS Linux integrates kubelet reasonably 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 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 the systemd unit file is placed, run the systemctl command to start kubelet.
sudo systemctl daemon-reloadsudo systemctl start kubelet
To ensure that kubelet can start automatically, You need to activate the service:
sudo systemctl enable kubelet
Then the kubelet service should have run. You can use the systemctl STATUS Command to confirm:
sudo systemctl status kubelet
Start a single-node Kubernetes Cluster
Kubelet provides a convenient interface for local system management containers. Kubelet provides a manifest dictionary that is monitored every 20 seconds to update the manifest file of the pod. Before that, use the-config flag in the kubelet systemd unit to configure the 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 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 may pose potential security risks. Therefore, make sure to check all pod manifest contents before using them.
cat kubernetes.yaml
In this case, we only need to copy the pod manifest kubernetes. yaml 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
In a few minutes, you will have a running Kubernetes cluster. Next, download the official Kubernetes client tool.
Download the Kubernetes Client
kubectl
Is 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/kubectlchmod +x kubectl
Kubectl can be used to obtain information about running clusters.
./kubectl cluster-info
The Kubernetes master runs at http: // localhost: 8080.
Kubectl can also be used to start pods
./kubectl run nginx --image=nginx
Run the get pods command to view the running pods:
./kubectl get pods
For more details about Kubernets, refer to Kubernetes on CoreOS docs.
Monitor containers with cAdvisor
Kubelet has a built-in cAdvisor that is used to collect, aggregate, process, and export information about containers running on 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.
If you are interested in Kubernetes, be sure to attend some Kubernetes training in your city. More arrangements will be put on the agenda and review records. If you want private online training, contact us.
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
CoreOS details: click here
CoreOS: click here
Original article: Introducing the Kubernetes kubelet in CoreOS Linux
This article permanently updates the link address: