Search code examples
operating-systemgoogle-kubernetes-enginechromium-os

How to download linux kernel headers for Google container optimized OS


I have to download kernel headers in 3 nodes in a Kubernetes cluster that is run on GKE. The nodes use Google's container optimized OS which appears to be a fork of Chromium OS.

How can I check if kernel headers are installed and where they are installed ? And how to install them if they are not already installed ? I tried using apt but it's not available in that OS.


Solution

  • a) As per the official doc:

    The Container-Optimized OS from Google node images are based on a recent version of the Linux kernel and are optimized to enhance node security. A team at Google that can quickly patch images for security and iterate on features backs Container-Optimized OS images. The Container-Optimized OS images provide better support, security, and stability than other images.

    b) As described in the doc:

    In some cases, The agent may not install correctly if the nodes in your Kubernetes environment use Unix versions that do not match the headers provided. The kernel headers must be manually installed on each node in those circumstances

    For RHEL-style distributions, run:

    yum -y install kernel-devel-$(uname -r)
    

    For more information on troubleshooting, refer to the Kernel Headers module

    c) The below commands described in the doc will help you in validating the kernel header:

    To check whether the kernel headers are installed (any user can run this):

    $ yum list kernel-devel-$(uname -r)
    

    To install the necessary kernel headers:

     $ sudo yum install -y kernel-devel-$(uname -r)
    

    When properly installed, the required kernel headers are located under:

    $ /usr/src/kernels/$(uname -r)/include/