gashirar's blog

ウイスキーがすき/美味しいものがすき/k8sがすき

Oracle Kubernetes Engineのproxymux-clientを眺める

はじめに

前回の記事ではOracke Kubernetes Engine(OKE)の各種Resourceをみました。
前回わからずじまいだったproxymux-client DaemonSetなのですが、Twitterの方でどのようなものか教えていただきました。
ありがとうございます。

API Serverとの通信周りの処理をするということは、結構重要そうなコンポーネントな気がします。以降はそれも含めproxymux-clientと戯れたメモです。

YAMLを眺める

ところどころ省略しています。

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  annotations:
    scheduler.alpha.kubernetes.io/critical-pod: ""
  labels:
    oke-app: proxymux-client-ds
  name: proxymux-client
  namespace: kube-system
spec:
  selector:
    matchLabels:
      oke-app: proxymux-client-ds
  template:
    metadata:
      labels:
        oke-app: proxymux-client-ds
    spec:
      containers:
      - args:
        - --config=/mnt/etc/proxymux/config.yaml
        - --verbosity=info
        image: [proxymux-cliのimage]
        name: proxymux-client
        resources:
          limits:
            cpu: 500m
            memory: 256Mi
          requests:
            cpu: 50m
            memory: 64Mi
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: /mnt/etc/proxymux/
          name: proxymux-cfg
          readOnly: true
        - mountPath: /etc/kubernetes/
          name: kubernetes-cfg
          readOnly: true
      dnsPolicy: ClusterFirst
      hostNetwork: true
      nodeSelector:
        node.info.ds_proxymux_client: "true"
      priority: 2000001000
      priorityClassName: system-node-critical
      volumes:
      - hostPath:
          path: /etc/proxymux/
          type: ""
        name: proxymux-cfg
      - hostPath:
          path: /etc/kubernetes/
          type: ""
        name: kubernetes-cfg

scheduler.alpha.kubernetes.io/critical-pod: ""

上記AnnotationはすでにDeprecateなものですが、もともとはMetrics ServerやDNSなどの落ちたらクラスタの稼働に影響するようなもの向けAnnotationです。 現在はsystem-node-critical PriorityClassでの設定が推奨されます。

Deprecate critical pod annotation by bsalamat · Pull Request #70298 · kubernetes/kubernetes · GitHub

hostNetwork: true

Pod Security Policies - Kubernetes

Controls whether the pod may use the node network namespace. Doing so gives the pod access to the loopback device, services listening on localhost, and could be used to snoop on network activity of other pods on the same node.

proxymux-clientの実装はわからないですが、API Serverとの通信のためにhostNetworkで何かしらやっていそうな感じはありますね。

priorityClassName: system-node-critical

critical-pod Annotationが非推奨になった代わりに利用するPriorityClassです。
詳しくは下記をどうぞ。
Guaranteed Scheduling For Critical Add-On Pods - Kubernetes

proxymux-cfg

# cat /mnt/etc/proxymux/config.yaml 

node-id: [NodeのOCID]
net-inf: ens3

server-addr: https://[MasterのIPアドレス]:12250
tm-id: oke
cluster-id: [クラスタID]
public-ip-address: 
private-ip-address: [NodeのPrivate IP]
node-name: [Node名]
cert-path: /var/lib/kubelet/pki
tenancy-id: [テナントのOCID]
bind-addr: [バインドされたIP]
oci-realm: oc1

hostPathからマウントしているということは、少なくともOKEのWorker Node上にはproxymux用の設定ファイルが常に配置されていることになりそうですね。

試しに消してみる

Criticalなものということはわかったので、試しに消してみましょう。
どこがどう壊れるかはわかりませんが、多分どこかが壊れるはず。

# kubectl delete ds -n kube-system proxymux-client
daemonset.extensions "proxymux-client" deleted

# kubectl get pod -A
NAMESPACE     NAME                                   READY   STATUS    RESTARTS   AGE
kube-system   coredns-67bb89d7c6-ddnvv               1/1     Running   0          3h45m
kube-system   coredns-67bb89d7c6-rwgnj               1/1     Running   0          3h45m
kube-system   coredns-67bb89d7c6-sdztr               1/1     Running   0          3h45m
kube-system   kube-dns-autoscaler-655fffb489-wsmhm   1/1     Running   0          3h45m
kube-system   kube-flannel-ds-h9cm9                  1/1     Running   1          29m
kube-system   kube-flannel-ds-p6lxm                  1/1     Running   1          29m
kube-system   kube-flannel-ds-z9k82                  1/1     Running   1          29m
kube-system   kube-proxy-58b2l                       1/1     Running   0          29m
kube-system   kube-proxy-7tgqn                       1/1     Running   0          29m
kube-system   kube-proxy-ql7fx                       1/1     Running   0          29m

kubectl get podは動きました。
とりあえず適当なPodのログでも見てみましょう。

# kubectl logs -n kube-system kube-flannel-ds-h9cm9
Error from server: Get https://10.0.10.10:10250/containerLogs/kube-system/kube-flannel-ds-h9cm9/kube-flannel: EOF

みれなくなっていました・・・。
やはりOKEには不可欠なものみたいです。無邪気に消すのはやめましょう。

まとめ

  • proxymux-clientはprivate subnetでクラスタをを作った際に、API Serverとの通信周りの処理を行う
  • priorityClassNamesystem-node-criticalが設定されており、クラスタ正常可能に必須なコンポーネントである(と思われる)

おわりに

DaemonSet戻すのを考えていなかったです。
どうしましょうか・・・。
Cluster作り直しかな。