问题描述
我正在尝试在我的AKS集群中的所有节点上安装nfs-kernel-server软件包。默认情况下,AKS Ubuntu 16.04中未安装NFS内核模块。我在这里遵循指南:https://medium.com/@patnaikshekhar/initialize-your-aks-nodes-with-daemonsets-679fa81fd20e。
我的守护进程:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: installer
namespace: node-installer
spec:
selector:
matchLabels:
job: installer
template:
metadata:
labels:
job: installer
spec:
hostPID: true
restartPolicy: Always
containers:
- image: patnaikshekhar/node-installer:1.3
name: installer
securityContext:
privileged: true
volumeMounts:
- name: install-script
mountPath: /tmp
- name: host-mount
mountPath: /host
volumes:
- name: install-script
configMap:
name: sample-installer-config
- name: host-mount
hostPath:
path: /tmp/install
这是我的configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-installer-config
namespace: node-installer
data:
install.sh: |
#!/bin/bash
# Update and install packages
apt-get update
apt-get install nfs-kernel-server -y
让Pod生成并完成(x3),当我检查其日志时,只有第一个Pod的日志会显示节点上安装的软件包。其余的豆荚根本没有日志。有办法可靠地做到这一点吗?
解决方法
完成此操作的方法是使用daemonset和configmap,以及具有特权的pod执行策略和主机路径安装。这样,容器可以将所需的软件包安装到主机节点上,并且守护程序会将配置应用于集群上的所有新节点。