Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to sync clocks of provisioned instances #321

Closed
frejonb opened this issue Aug 24, 2019 · 3 comments
Closed

How to sync clocks of provisioned instances #321

frejonb opened this issue Aug 24, 2019 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@frejonb
Copy link

frejonb commented Aug 24, 2019

I'm running into an issue with prometheus where data shows as not available because the EC2 instance clock is behind by 7 minutes to the current time. This can be solver by using NTP but how can I add this during provisioning of the worker nodes? There doesn't seem to be an option in the bootstrap script.

Environment:

  • AWS Region: eu-west-1
  • Instance Type(s): t2.large
  • EKS Platform version (use aws eks describe-cluster --name <name> --query cluster.platformVersion): eks.2
  • Kubernetes version (use aws eks describe-cluster --name <name> --query cluster.version):
  • AMI Version: 1.13
  • Kernel (e.g. uname -a):
  • Release information (run cat /etc/eks/release on a node):
@whereisaaron
Copy link

whereisaaron commented Aug 24, 2019

@frejonb eek! chronyd is supposed to be running on nodes to sync time against the tsc or else xen clock sources. Is that not happening on your nodes?

https://github.com/awslabs/amazon-eks-ami/blob/master/install-worker.sh#L67-L87

################################################################################
### Time #######################################################################
################################################################################

# Make sure Amazon Time Sync Service starts on boot.
sudo chkconfig chronyd on

# Make sure that chronyd syncs RTC clock to the kernel.
cat <<EOF | sudo tee -a /etc/chrony.conf
# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync
EOF

# If current clocksource is xen, switch to tsc
if grep --quiet xen /sys/devices/system/clocksource/clocksource0/current_clocksource &&
  grep --quiet tsc /sys/devices/system/clocksource/clocksource0/available_clocksource; then
    echo "tsc" | sudo tee /sys/devices/system/clocksource/clocksource0/current_clocksource
else
    echo "tsc as a clock source is not applicable, skipping."
fi

@cwhatley
Copy link

cwhatley commented May 8, 2020

Just came here b/c I was surprised to see that some g3.8xlarge instances I have in a cluster for 1.14 20191213 version of the AMIs had xen not tsc as the source. I don't think that code in the install-worker.sh script is working.

This should probably be reopened:
#249

Perhaps the problem is that the instances that are used to build the images are nitro which has kvm-clock as the default. If I understand the build process, this install-worker.sh script is run at image build time, so I think maybe a boot time check of the clock source is better than a build-time check.

@cartermckinnon
Copy link
Member

I've reopened #249 and am closing this as duplicate.

@cartermckinnon cartermckinnon added the duplicate This issue or pull request already exists label Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants