k3s/pkg/kubelet
Kubernetes Submit Queue 17175b24a2 Merge pull request #40007 from JulienBalestra/rktnetes-systemd-ops-helpers
Automatic merge from submit-queue (batch tested with PRs 41812, 41665, 40007, 41281, 41771)

Kubelet-rkt: Add useful informations for Ops on the Kubelet Host

Create a Systemd SyslogIdentifier inside the [Service]
Create a Systemd Description inside the [Unit]

**What this PR does / why we need it**:

#### Overview
Logged against the host, it's difficult to identify who's who.
This PR add useful information to quickly get straight to the point with the **DESCRIPTION** field:

```
systemctl list-units "k8s*"
UNIT                                             LOAD   ACTIVE SUB     DESCRIPTION
k8s_b5a9bdf7-e396-4989-8df0-30a5fda7f94c.service loaded active running kube-controller-manager-172.20.0.206
k8s_bec0d8a1-dc15-4b47-a850-e09cf098646a.service loaded active running nginx-daemonset-gxm4s
k8s_d2981e9c-2845-4aa2-a0de-46e828f0c91b.service loaded active running kube-apiserver-172.20.0.206
k8s_fde4b0ab-87f8-4fd1-b5d2-3154918f6c89.service loaded active running kube-scheduler-172.20.0.206

```

#### Overview and Journal

Always on the host, to easily retrieve the pods logs, this PR add a SyslogIdentifier named as the PodBaseName.


```
# A DaemonSet prometheus-node-exporter is running on the Kubernetes Cluster
systemctl list-units "k8s*" | grep prometheus-node-exporter
k8s_c60a4b1a-387d-4fce-afa1-642d6f5716c1.service loaded active running prometheus-node-exporter-85cpp

# Get the logs from the prometheus-node-exporter DaemonSet 
journalctl -t prometheus-node-exporter | wc -l
278
```

Sadly the `journalctl` flag `-t` / `--identifier` doesn't allow a pattern to catch the logs.

Also this field improve any queries made by any tools who exports the Journal (E.g: ES, Kibana):
```
{
	"__CURSOR" : "s=86fd390d123b47af89bb15f41feb9863;i=164b2c27;b=7709deb3400841009e0acc2fec1ebe0e;m=1fe822ca4;t=54635e6a62285;x=b2d321019d70f36f",
	"__REALTIME_TIMESTAMP" : "1484572200411781",
	"__MONOTONIC_TIMESTAMP" : "8564911268",
	"_BOOT_ID" : "7709deb3400841009e0acc2fec1ebe0e",
	"PRIORITY" : "6",
	"_UID" : "0",
	"_GID" : "0",
	"_SYSTEMD_SLICE" : "system.slice",
	"_SELINUX_CONTEXT" : "system_u:system_r:kernel_t:s0",
	"_MACHINE_ID" : "7bbb4401667243da81671e23fd8a2246",
	"_HOSTNAME" : "Kubelet-Host",
	"_TRANSPORT" : "stdout",
	"SYSLOG_FACILITY" : "3",
	"_COMM" : "ld-linux-x86-64",
	"_CAP_EFFECTIVE" : "3fffffffff",
	"SYSLOG_IDENTIFIER" : "prometheus-node-exporter",
	"_PID" : "88827",
	"_EXE" : "/var/lib/rkt/pods/run/c60a4b1a-387d-4fce-afa1-642d6f5716c1/stage1/rootfs/usr/lib64/ld-2.21.so",
	"_CMDLINE" : "stage1/rootfs/usr/lib/ld-linux-x86-64.so.2 stage1/rootfs/usr/bin/systemd-nspawn [....]",
	"_SYSTEMD_CGROUP" : "/system.slice/k8s_c60a4b1a-387d-4fce-afa1-642d6f5716c1.service",
	"_SYSTEMD_UNIT" : "k8s_c60a4b1a-387d-4fce-afa1-642d6f5716c1.service",
	"MESSAGE" : "[ 8564.909237] prometheus-node-exporter[115]: time=\"2017-01-16T13:10:00Z\" level=info msg=\" - time\" source=\"node_exporter.go:157\""
}
```
2017-02-23 00:11:38 -08:00
..
api CRI: use more gogoprotobuf plugins 2017-01-25 13:52:24 -08:00
cadvisor Update generated files 2017-01-29 21:41:45 +01:00
certificate Rotate the kubelet certificate when about to expire. 2017-02-17 17:42:35 -08:00
client
cm Enable per pod cgroups, fix defaulting of cgroup-root when not specified 2017-02-21 16:34:22 -05:00
config Use clientset.Interface for KubeClient 2017-02-03 07:36:16 -08:00
container kubelet: handle containers in the "created" state 2017-02-14 07:51:35 -08:00
custommetrics
dockershim initialize directory while creating checkpoint file store 2017-02-17 16:56:46 -08:00
dockertools fix issue #41746 2017-02-21 18:41:27 +08:00
envvars
events switch kubelet to use external (client-go) object references for events 2017-01-31 19:15:33 -05:00
eviction Merge pull request #41147 from derekwaynecarr/improve-eviction-logs 2017-02-09 17:41:41 -08:00
images switch kubelet to use external (client-go) object references for events 2017-01-31 19:15:33 -05:00
kuberuntime kubelet: reduce extraneous logging for pods using host network 2017-02-14 16:09:42 -08:00
leaky
lifecycle move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
metrics
network Merge pull request #37036 from dcbw/docker-gc-teardown-pods 2017-02-16 17:05:12 -08:00
pleg
pod Avoid evicting critical pods in Kubelet if a special feature gate is enabled 2017-02-02 11:32:20 -08:00
prober Revert "Merge pull request #41202 from dashpole/revert-41095-deletion_pod_lifecycle" 2017-02-15 08:44:03 -08:00
qos Avoid evicting critical pods in Kubelet if a special feature gate is enabled 2017-02-02 11:32:20 -08:00
remote Fix typo of defualt 2017-02-11 22:28:24 +08:00
rkt Merge pull request #40007 from JulienBalestra/rktnetes-systemd-ops-helpers 2017-02-23 00:11:38 -08:00
rktshim
secret Implements projected volume driver 2017-02-20 12:56:04 -05:00
server Merge pull request #39837 from foxyriver/modify-comment 2017-02-21 16:33:47 -06:00
status Revert "Merge pull request #41202 from dashpole/revert-41095-deletion_pod_lifecycle" 2017-02-15 08:44:03 -08:00
sysctl
types Avoid evicting critical pods in Kubelet if a special feature gate is enabled 2017-02-02 11:32:20 -08:00
util Split `RequestNodeCertificate` function. 2017-02-17 07:40:48 -08:00
volumemanager Merge pull request #41456 from dashpole/pod_volume_cleanup 2017-02-16 10:14:05 -08:00
BUILD Rotate the kubelet certificate when about to expire. 2017-02-17 17:42:35 -08:00
OWNERS
active_deadline.go move client/record 2017-01-31 19:14:13 -05:00
active_deadline_test.go move client/record 2017-01-31 19:14:13 -05:00
disk_manager.go
disk_manager_test.go
doc.go
kubelet.go Merge pull request #41569 from yujuhong/add_healthcheck 2017-02-16 15:49:18 -08:00
kubelet_cadvisor.go
kubelet_cadvisor_test.go kubelet: Make cadvisor GetContainerInfo tests table driven 2017-02-15 16:15:21 +01:00
kubelet_getters.go
kubelet_getters_test.go
kubelet_network.go
kubelet_network_test.go move client/record 2017-01-31 19:14:13 -05:00
kubelet_node_status.go Change taint/toleration annotations to api fields. 2017-02-22 09:27:42 -05:00
kubelet_node_status_test.go pkg/api: move Semantic equality to k8s.io/apimachinery/pkg/api/equality 2017-01-29 21:41:45 +01:00
kubelet_pods.go Merge pull request #39373 from apprenda/fix_configmap 2017-02-19 13:50:37 -08:00
kubelet_pods_test.go Merge pull request #33550 from rtreffer/kubelet-allow-multiple-dns-server 2017-02-15 12:45:32 -08:00
kubelet_pods_windows_test.go
kubelet_resources.go
kubelet_resources_test.go pkg/api: move Semantic equality to k8s.io/apimachinery/pkg/api/equality 2017-01-29 21:41:45 +01:00
kubelet_test.go Revert "Merge pull request #41202 from dashpole/revert-41095-deletion_pod_lifecycle" 2017-02-15 08:44:03 -08:00
kubelet_volumes.go kubelet volumes cleanupOrphanedPodDirs does not distinguish error from found volume paths 2017-02-17 09:07:54 -05:00
kubelet_volumes_test.go move testing/core to client-go 2017-01-26 13:54:40 -05:00
networks.go add portmapping getter into network host 2017-02-08 09:35:04 -08:00
oom_watcher.go switch kubelet to use external (client-go) object references for events 2017-01-31 19:15:33 -05:00
oom_watcher_test.go switch kubelet to use external (client-go) object references for events 2017-01-31 19:15:33 -05:00
pod_container_deletor.go
pod_container_deletor_test.go
pod_workers.go move client/record 2017-01-31 19:14:13 -05:00
pod_workers_test.go move client/record 2017-01-31 19:14:13 -05:00
reason_cache.go
reason_cache_test.go
runonce.go
runonce_test.go Revert "Merge pull request #41202 from dashpole/revert-41095-deletion_pod_lifecycle" 2017-02-15 08:44:03 -08:00
runtime.go
util.go
volume_host.go