0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntu で Kubernetes 三昧その7(Deamonset)

Last updated at Posted at 2025-06-23

Ubuntu で Kubernetes 三昧その6(clusterrole, serviceaccount, Deployment)の続きです。

このコマンドを実行します。
コントロールプレーンです。

@controlplane1:~/kubernetes-examples$ kubectl apply -f daemonset/nginx.yaml
daemonset.apps/nginx-deployment created

ここで、ちょっとしたことに気づきました。どうやら、コントロールプレーンがうまく動いていないようです。

@masternode1:~$ kubectl describe node masternode1
Name:               masternode1
Roles:              control-plane
Labels:             beta.kubernetes.io/arch=amd64
                    beta.kubernetes.io/os=linux
                    kubernetes.io/arch=amd64
                    kubernetes.io/hostname=masternode1
                    kubernetes.io/os=linux
                    node-role.kubernetes.io/control-plane=
                    node.kubernetes.io/exclude-from-external-load-balancers=
Annotations:        kubeadm.alpha.kubernetes.io/cri-socket: unix:///var/run/containerd/containerd.sock
                    node.alpha.kubernetes.io/ttl: 0
                    volumes.kubernetes.io/controller-managed-attach-detach: true
CreationTimestamp:  Sat, 21 Jun 2025 18:27:56 +0900
Taints:             node.kubernetes.io/unreachable:NoExecute
                    node-role.kubernetes.io/control-plane:NoSchedule
                    node.kubernetes.io/unreachable:NoSchedule
Unschedulable:      false
Lease:
  HolderIdentity:  masternode1
  AcquireTime:     <unset>
  RenewTime:       Mon, 23 Jun 2025 09:04:56 +0900
Conditions:
  Type                 Status    LastHeartbeatTime                 LastTransitionTime                Reason              Message
  ----                 ------    -----------------                 ------------------                ------              -------
  NetworkUnavailable   False     Sun, 22 Jun 2025 10:55:10 +0900   Sun, 22 Jun 2025 10:55:10 +0900   WeaveIsUp           Weave pod has set this
  MemoryPressure       Unknown   Mon, 23 Jun 2025 09:04:23 +0900   Mon, 23 Jun 2025 09:08:32 +0900   NodeStatusUnknown   Kubelet stopped posting node status.
  DiskPressure         Unknown   Mon, 23 Jun 2025 09:04:23 +0900   Mon, 23 Jun 2025 09:08:32 +0900   NodeStatusUnknown   Kubelet stopped posting node status.
  PIDPressure          Unknown   Mon, 23 Jun 2025 09:04:23 +0900   Mon, 23 Jun 2025 09:08:32 +0900   NodeStatusUnknown   Kubelet stopped posting node status.
  Ready                Unknown   Mon, 23 Jun 2025 09:04:23 +0900   Mon, 23 Jun 2025 09:08:32 +0900   NodeStatusUnknown   Kubelet stopped posting node status.
Addresses:
  InternalIP:  10.0.2.15
  Hostname:    masternode1
Capacity:
  cpu:                4
  ephemeral-storage:  25623780Ki
  hugepages-2Mi:      0
  memory:             4008868Ki
  pods:               110
Allocatable:
  cpu:                4
  ephemeral-storage:  23614875609
  hugepages-2Mi:      0
  memory:             3906468Ki
  pods:               110
System Info:
  Machine ID:                 43cd959a38a540419cbe1905a9d4bea1
  System UUID:                30f05dee-44f6-0a4d-ae10-65bf368cb4c2
  Boot ID:                    66a21590-cc21-4214-94b7-0e5e01adf03d
  Kernel Version:             6.11.0-26-generic
  OS Image:                   Ubuntu 24.04.2 LTS
  Operating System:           linux
  Architecture:               amd64
  Container Runtime Version:  containerd://2.1.3
  Kubelet Version:            v1.33.2
  Kube-Proxy Version:         
Non-terminated Pods:          (6 in total)
  Namespace                   Name                                   CPU Requests  CPU Limits  Memory Requests  Memory Limits  Age
  ---------                   ----                                   ------------  ----------  ---------------  -------------  ---
  kube-system                 etcd-masternode1                       100m (2%)     0 (0%)      100Mi (2%)       0 (0%)         2d
  kube-system                 kube-apiserver-masternode1             250m (6%)     0 (0%)      0 (0%)           0 (0%)         2d
  kube-system                 kube-controller-manager-masternode1    200m (5%)     0 (0%)      0 (0%)           0 (0%)         2d
  kube-system                 kube-proxy-km2s7                       0 (0%)        0 (0%)      0 (0%)           0 (0%)         2d
  kube-system                 kube-scheduler-masternode1             100m (2%)     0 (0%)      0 (0%)           0 (0%)         2d
  kube-system                 weave-net-v2fhz                        100m (2%)     0 (0%)      0 (0%)           0 (0%)         31h
Allocated resources:
  (Total limits may be over 100 percent, i.e., overcommitted.)
  Resource           Requests    Limits
  --------           --------    ------
  cpu                750m (18%)  0 (0%)
  memory             100Mi (2%)  0 (0%)
  ephemeral-storage  0 (0%)      0 (0%)
  hugepages-2Mi      0 (0%)      0 (0%)
Events:
  Type    Reason          Age   From             Message
  ----    ------          ----  ----             -------
  Normal  RegisteredNode  11m   node-controller  Node masternode1 event: Registered Node masternode1 in Controller

kubelet は立ち上がっているものの、ホスト名を controlplane1 に変更したのが原因で、不具合が発生しているようでした。

名前を、masternode1 に戻し、kubelete をリスタートしました。
事象は解消しました。
それでは、Daemonsetを確認します。名前が deployment となっていて紛らわしいですが。

@masternode1:~$ kubectl get daemonsets -o wide
NAME               DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE   CONTAINERS        IMAGES         SELECTOR
nginx-deployment   1         1         1       1            1           <none>          34m   nginxdeployment   nginx:latest   app=nginxdeployment

@masternode1:~$ kubectl get pods -o wide
NAME                     READY   STATUS    RESTARTS      AGE   IP          NODE          NOMINATED NODE   READINESS GATES
nginx-deployment-t2xbx   1/1     Running   1 (32m ago)   38m   10.32.0.4   workernode1   <none>           <none>

@masternode1:~$ kubectl describe pod nginx-deployment-t2xbx
Name:             nginx-deployment-t2xbx
Namespace:        default
Priority:         0
Service Account:  default
Node:             workernode1/10.0.2.7
...(snip)...

DaemonSet は workernode1 にだけ作成されていて、コントロールプレーンノードに作成されないのは、ノードを保護するための Taint が原因であり、正常な動作です。

Ubuntu で Kubernetes 三昧その 8(Statefulset)につづく。

参考:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?