January 2018
Intermediate to advanced
318 pages
7h 6m
English
Now that we have our environment prepared we can deploy the function. To do this we need two files; the first is the requirements.txt file, this contains just two lines:
python-twitterkubernetes==2.0.0
The requirements.txt file lets Python know which external libraries to deploy alongside our code. In our file we are using the twitter library so that we can post the tweet easily, and also the kubernetes library to decode the secrets we created in the previous section. Using the libraries means that our code is quite streamlined, as all of the hard work takes place outside our core function. The code for the function is as follows:
import base64import twitterfrom kubernetes import client, configconfig.load_incluster_config() ...
Read now
Unlock full access