How do you install Python libraries on gcloud kubernetes nodes?

4/6/2018

I have a gcloud Kubernetes cluster running and a Google bucket that holds some data I want to run on the cluster.

In order to use the data in the bucket, I need gcsfs installed on the nodes. How do I install packages like this on the cluster using gcloud, kubectl, etc.?

-- Brendan Martin
google-compute-engine
kubernetes

2 Answers

4/10/2018

I don't know if the suggestion given by VonC will actually work, but what I do know is that you're not really supposed to install stuff onto a Kubernetes Engine's worker node. This is evident by the fact that neither does it have a package manager nor does it allow to update individual programs separately.

Container-Optimized OS does not support traditional package managers (...) This design prevents updating individual software packages in the root filesystem independent of other packages.

Having said that, you can customize the worker nodes of a node pool if the number of nodes is static for that node pool via startup scripts. These still work as intended, but since you can't edit the instance template being used by the node pool, you'll have to edit those into the instances manually. So again, this clearly is not a very good way of doing things.

Finally, worker nodes have something called a "Toolbox", which is basically a special container you can run to get access to debugging tools. This container is ran directly on Docker, it's not scheduled by Kubernetes. You can customize this container image, so you can add some extra tools into it.

-- Lopson
Source: StackOverflow

4/6/2018

Check if a recipe like "Launch development cluster on Google Cloud Platform with Kubernetes and Helm" could help.

Using Helm, you can define workers with additional pip packages:

worker:
  replicas: 8
  limits:
    cpu: 2
    memory: 7500000000
  pipPackages: >-
    git+https://github.com/gcsfs/gcsfs.git
    git+https://github.com/xarray/xarray.git
  condaPackages: >-
    -c conda-forge 
    zarr
    blosc
-- VonC
Source: StackOverflow