kube-shell安装
1.开源项目kube-shell可以为kubectl提供自动的命令提示和补全,对于初学kubernetes比较友好。
GitHub地址
https://github.com/cloudnativelabs/kube-shell
1.1Kube-shell有以下特性:
1.2命令提示,给出命令的使用说明
1.3自动补全,列出可选命令并可以通过tab键自动补全,支持模糊搜索
1.4高亮
1.5使用tab键可以列出可选的对象
1.6vim模式
安装步骤:
2.安装python3
root@kubernetes-master01:~# apt install python3-pip
Conflicts: xserver-xspice
xubuntu-core : Depends: lightdm but it is not going to be installed
Depends: xubuntu-artwork but it is not going to be installed
Depends: xubuntu-default-settings but it is not going to be installed
ycmd : Depends: python2.7 but it is not going to be installed
3.安装kube-shell
root@kubernetes-master01:~# pip3 install kube-shell
Collecting kube-shell
Downloading https://files.pythonhosted.org/packages/1e/91/9f61278c4c920c0161f7069e94a45351e6952ea05254fa983de0148a1af5/kube-shell-0.0.23.tar.gz
Collecting Pygments<3.0.0,>=2.1.3 (from kube-shell)
Downloading https://files.pythonhosted.org/packages/78/c8/8d9be2f72d8f465461f22b5f199c04f7ada933add4dae6e2468133c17471/Pygments-2.10.0-py3-none-any.whl (1.0MB)
100% |████████████████████████████████| 1.0MB 23kB/s
Requirement already satisfied: click<7.0,>=4.0 in /usr/lib/python3/dist-packages (from kube-shell)
Collecting fuzzyfinder>=1.0.0 (from kube-shell)
Downloading https://files.pythonhosted.org/packages/6c/80/e23249f1119435d00d0a226debbb0390de4b6ad456c1939de94512b946c8/fuzzyfinder-2.1.0-py2.py3-none-any.whl
Collecting kubernetes<3.0.0,>=0.10.0 (from kube-shell)
Downloading https://files.pythonhosted.org/packages/ea/09/cea2d2d6596eaa0e193aeee3c18f670148e6193abf5dd26897e4b280cc88/kubernetes-2.0.0-py2.py3-none-any.whl (718kB)
100% |████████████████████████████████| 727kB 14kB/s
Collecting prompt-toolkit<1.1.0,>=1.0.10 (from kube-shell)
Downloading https://files.pythonhosted.org/packages/64/27/5fd61a451d086ad4aa806dc72fe1383d2bc0e74323668672287f616d5d51/prompt_toolkit-1.0.18-py3-none-any.whl (245kB)
100% |████████████████████████████████| 245kB 23kB/s
Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Collecting oauth2client (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Downloading https://files.pythonhosted.org/packages/95/a9/4f25a14d23f0786b64875b91784607c2277eff25d48f915e39ff0cff505a/oauth2client-4.1.3-py2.py3-none-any.whl (98kB)
100% |████████████████████████████████| 102kB 14kB/s
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Collecting python-dateutil (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Downloading https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247kB)
100% |████████████████████████████████| 256kB 23kB/s
Collecting ipaddress (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Downloading https://files.pythonhosted.org/packages/c2/f8/49697181b1651d8347d24c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl
Requirement already satisfied: urllib3!=1.21 in /usr/lib/python3/dist-packages (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Requirement already satisfied: pyyaml in /usr/lib/python3/dist-packages (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Collecting websocket-client (from kubernetes<3.0.0,>=0.10.0->kube-shell)
Downloading https://files.pythonhosted.org/packages/55/44/030ea47390896c8d6dc9995c8e9a4c5df3a161cd45416d88119036c73eda/websocket_client-1.2.1-py2.py3-none-any.whl (52kB)
100% |████████████████████████████████| 61kB 20kB/s
Collecting wcwidth (from prompt-toolkit<1.1.0,>=1.0.10->kube-shell)
Downloading https://files.pythonhosted.org/packages/59/7c/e39aca596badaf1b78e8f547c807b04dae603a433d3e7a7e04d67f2ef3e5/wcwidth-0.2.5-py2.py3-none-any.whl
Requirement already satisfied: pyasn1>=0.1.7 in /usr/lib/python3/dist-packages (from oauth2client->kubernetes<3.0.0,>=0.10.0->kube-shell)
Collecting rsa>=3.1.4 (from oauth2client->kubernetes<3.0.0,>=0.10.0->kube-shell)
Downloading https://files.pythonhosted.org/packages/30/ab/8fd9e88e6fa5ec41afca995938bbefb72195278e0cfc5bd76a4f29b23fb2/rsa-4.8-py3-none-any.whl
Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/lib/python3/dist-packages (from oauth2client->kubernetes<3.0.0,>=0.10.0->kube-shell)
Requirement already satisfied: httplib2>=0.9.1 in /usr/lib/python3/dist-packages (from oauth2client->kubernetes<3.0.0,>=0.10.0->kube-shell)
Building wheels for collected packages: kube-shell
Running setup.py bdist_wheel for kube-shell ... done
Stored in directory: /root/.cache/pip/wheels/2a/4c/8e/c74335e6a976ef8658e7fc15bb37053eae0a65d48750afbd2a
Successfully built kube-shell
Installing collected packages: Pygments, fuzzyfinder, rsa, oauth2client, python-dateutil, ipaddress, websocket-client, kubernetes, wcwidth, prompt-toolkit, kube-shell
Successfully installed Pygments-2.10.0 fuzzyfinder-2.1.0 ipaddress-1.0.23 kube-shell-0.0.23 kubernetes-2.0.0 oauth2client-4.1.3 prompt-toolkit-1.0.18 python-dateutil-2.8.2 rsa-4.8 wcwidth-0.2.5 websocket-client-1.2.1
4.安装完成,直接打开
root@kubernetes-master01:~# kube-shell
kube-shell>
kube-shell>
kube-shell> kubectl get pods
kubectl kubectl controls the Kubernetes cluster manager
[F4] Cluster: kubernetes [F5] Namespace: default User: kubernetes-admin [F9] In-line help: ON [F10] Exit
我们一直奔跑在进步的旅途