Problem Description
Recently I keep seeing the NTP issue with my custom AMI images. Some reason chrony daemonsets is not working as expected and seeing the intermittent issue. Possibly some configuration problems.
Solutions:
I decide to write a quick Kubernetes daemonsets to fix this problem. Daemoset is running a simple alpine container. And a while loop while true; do hwclock -s; sleep 86400; done, which basically run hwclock -s command sleep for =24_60_60 seconds = 1 day.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: ntp-sync
labels:
k8s-app: ntp-sync
spec:
selector:
matchLabels:
name: ntp-sync
template:
metadata:
labels:
name: ntp-sync
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
containers:
- name: ntp-sync
image: alpine
command: ["/bin/sh"]
args: ["-c", "while true; do hwclock -s; sleep 86400; done"]
resources:
limits:
memory: 20Mi
cpu: 20m
requests:
cpu: 10m
memory: 10Mi
securityContext:
privileged: true
Top comments (0)