kubectl get nodes
. It is a powerful foundation for automation and integration with existing tools. One such tool is the SSH utility Fabric , also known as fabfile.py
.Note trans. : Fabric is a Python-written library and command utility that simplifies SSH access for application deployment and system administration. It provides both the simplest execution of shell commands and more complex operations: upload / download files, request user input, interrupt process execution. A typical use of fabfile is to create a module in Python that implements one or more functions, after which they are invoked via the console utility fab
. More information about the capabilities of Fabric can be found in the official documentation .
$ fab --version Fabric 1.13.1
Note trans. : In the case of Ubuntu, simply install the fabric
package, which is available in the main repositories.
git clone https://github.com/coreos/fabric-kubernetes-nodes cd fabric-kubernetes-nodes
fabfile.py
from the root of this directory. Therefore, Kubernetes nodes and labels are now available in Fabric. Here is an example session using this integration: $ kubectl get nodes NAME STATUS AGE ip-10-0-0-50.us-west-2.compute.internal Ready 22d ip-10-0-60-201.us-west-2.compute.internal Ready 22d ip-10-0-95-156.us-west-2.compute.internal Ready 22d $ kubectl label node ip-10-0-0-50.us-west-2.compute.internal fab-admin=true node "ip-10-0-0-50.us-west-2.compute.internal" labeled $ fab -u core -R fab-admin=true -- date [52.26.54.211] Executing task '<remainder>' [52.26.54.211] run: date [52.26.54.211] out: Wed Feb 15 22:42:47 UTC 2017 [52.26.54.211] out: Done. Disconnecting from 52.26.54.211... done.
--gateway
flag to the --gateway
and change the address type to InternalIP
. $ export FAB_KUBE_NODE_ADDRESS_TYPE=InternalIP $ fab --gateway=WXYZ -u core -R failure-domain.beta.kubernetes.io/zone=us-west-2a -- date [10.0.3.24] Executing task '<remainder>' [10.0.3.24] run: date [10.0.3.24] out: Mon May 1 02:50:13 UTC 2017 [10.0.3.24] out:</remainder> [10.0.60.15] Executing task '<remainder>' [10.0.60.15] run: date [10.0.60.15] out: Mon May 1 02:50:16 UTC 2017 [10.0.60.15] out:</remainder> Done. Disconnect
ExternalIP
) nodes. However, it can be configured to any IP addresses that the node has. The example above uses the general InternalIP
field, and to change it to an arbitrary SpecialIP
, export the variable to the environment accordingly ( FAB_KUBE_NODE_ADDRESS_TYPE=SpecialIP
).Source: https://habr.com/ru/post/328648/
All Articles