kubeconfig
linode-cli
Install linode-cli
:
$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install linode-cli
Collecting linode-cli
Using cached linode_cli-5.10.1-py2.py3-none-any.whl (175 kB)
Collecting terminaltables
Using cached terminaltables-3.1.0.tar.gz (12 kB)
Collecting PyYAML
Using cached PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl (630 kB)
Collecting requests
Using cached requests-2.26.0-py2.py3-none-any.whl (62 kB)
Collecting urllib3<1.27,>=1.21.1
Using cached urllib3-1.26.7-py2.py3-none-any.whl (138 kB)
Collecting charset-normalizer~=2.0.0
Using cached charset_normalizer-2.0.6-py3-none-any.whl (37 kB)
Collecting idna<4,>=2.5
Using cached idna-3.2-py3-none-any.whl (59 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Using legacy 'setup.py install' for terminaltables, since package 'wheel' is not installed.
Installing collected packages: urllib3, idna, charset-normalizer, certifi, terminaltables, requests, PyYAML, linode-cli
Running setup.py install for terminaltables ... done
Successfully installed PyYAML-5.4.1 certifi-2021.10.8 charset-normalizer-2.0.6 idna-3.2 linode-cli-5.10.1 requests-2.26.0 terminaltables-3.1.0 urllib3-1.26.7
$ source <(linode-cli completion bash)
$ linode-cli linodes list
┌──────────┬─────────────────────────────┬────────────┬───────────────┬─────────────────────────────┬─────────┬─────────────────────────────────┐
│ id │ label │ region │ type │ image │ status │ ipv4 │
├──────────┼─────────────────────────────┼────────────┼───────────────┼─────────────────────────────┼─────────┼─────────────────────────────────┤
│ 30721727 │ lke39473-64379-615ec4bfcab8 │ eu-central │ g6-standard-1 │ linode/debian9-kube-v1.21.1 │ running │ 139.162.175.72, 192.168.129.32 │
│ 30721729 │ lke39473-64379-615ec4c02cea │ eu-central │ g6-standard-1 │ linode/debian9-kube-v1.21.1 │ running │ 139.162.175.136, 192.168.129.33 │
└──────────┴─────────────────────────────┴────────────┴───────────────┴─────────────────────────────┴─────────┴─────────────────────────────────┘
$ linode-cli lke clusters-list
┌───────┬──────────┬────────────┐
│ id │ label │ region │
├───────┼──────────┼────────────┤
│ 39473 │ learnk8s │ eu-central │
└───────┴──────────┴────────────┘
id | label | region |
---|---|---|
39473 | learnk8s | eu-central |
kubeconfig
#!/bin/bash
set -e
umask 077
CLUSER_ID=39473
linode-cli lke kubeconfig-view ${CLUSER_ID} --text --no-headers \
| base64 -d \
| tee kubeconfig