官术网_书友最值得收藏!

Command line

The kubectl script has commands to explore our cluster and the workloads running on it. You can find it in the /kubernetes/client/bin folder. We will be using this command throughout the book, so let's take a second to set up our environment. We can do so by putting the binaries folder on our PATH, in the following manner:

$ export PATH=$PATH:/<Path where you downloaded K8s>/kubernetes/client/bin
$ chmod +x /<Path where you downloaded K8s>/kubernetes/client/bin
You may choose to download the kubernetes folder outside your home folder, so modify the preceding command as appropriate.
It is also a good idea to make the changes permanent by adding the export command to the end of your .bashrc file in your home directory.

Now that we have kubectl on our path, we can start working with it. It has quite a few commands. Since we have not spun up any applications yet, most of these commands will not be very interesting. However, we can explore with two commands right away.

First, we have already seen the cluster-info command during initialization, but we can run it again at any time with the following command:

$ kubectl cluster-info

Another useful command is get. It can be used to see currently running services, pods, replication controllers, and a lot more. Here are the three examples that are useful right out of the gate:

  • List the nodes in our cluster:
    $ kubectl get nodes
  • List cluster events:
    $ kubectl get events
  • Finally, we can see any services that are running in the cluster, as follows:
    $ kubectl get services

To start with, we will only see one service, named kubernetes. This service is the core API server for the cluster.

主站蜘蛛池模板: 全州县| 定陶县| 南京市| 高安市| 梨树县| 昌吉市| 嘉定区| 彩票| 绩溪县| 台山市| 同心县| 五常市| 陇南市| 永康市| 四会市| 三江| 大洼县| 德阳市| 日喀则市| 铁岭县| 绥化市| 湘潭市| 金川县| 永平县| 呼和浩特市| 柞水县| 堆龙德庆县| 延边| 门头沟区| 库伦旗| 汪清县| 隆林| 长寿区| 连城县| 岢岚县| 天祝| 屏东县| 水城县| 马龙县| 宣恩县| 苏尼特右旗|