zoukankan      html  css  js  c++  java
  • kubectl plugin的使用

    为了扩展kubectl的功能,Kubernetes从1.8版本开始引入插件机制,在1.14版本时达到稳定版。用户自定义插件的可执行文件名需要以“kubectl-”开头,复制到$PATH中的某个目录(如/usr/local/bin),然后就可以通过kubectl 运行自定义插件了。

    比如创建一个名为kubectl-hello的文件:

    echo "hello world"
    

    添加可执行权限,然后拷贝到/usr/local/bin目录下,通过kubectl plugin list命令可以查看所有的插件

    [root@kub01 kubebin]# kubectl plugin list
    The following compatible plugins are available:
    
    /usr/local/bin/kubectl-hello
      - warning: /usr/local/bin/kubectl-hello identified as a kubectl plugin, but it is not executable
    Unable read directory "/root/bin" from your PATH: open /root/bin: no such file or directory. Skipping...
    error: one plugin warning was found
    

    警告没有/roo/bin的目录,我们可以自行创建

    mkdir -p /root/bin
    

    然后直接运行kutectl hello,这里有个报错

    exec format error
    

    在脚本头添加#!/bin/bash

    #!/bin/bash
    
    echo "hello world"
    

    再次运行正常

  • 相关阅读:
    SVN客户端的安装和使用
    SVN服务器的安装和使用
    ssh port forwarding
    mysql 索引
    ssh forwarding 配置
    pymongo collection.save 问题
    linux 实现VLAN
    linux 硬件中断调节
    M2Crypto
    python 时间四舍五入
  • 原文地址:https://www.cnblogs.com/zmichael/p/12221105.html
Copyright © 2011-2022 走看看