openshift-client installation and use

openshift-client installation and use

Install

1. Visit the official github address 
to select the appropriate version, download it, and upload it to the linux server that needs to install the client

2. Unzip

tar -xf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz 

3. Add the decompressed kubectl, oc to $PATH

mv openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit  /root/openshift-cli
vim /etc/bashrc
# 在文件末尾台添加
# export PATH=/root/openshift-cli:$PATH
source /etc/bashrc

Common commands

Common commands

oc login 登录系统
oc get project 查询项目列表
oc project <project_name> 切换到项目
oc get pod 查询容器列表
oc logs <project_name> 查询容器日志输出
oc rsh <project_name> 到容器执行命令
oc rsync <project_name> :<dir> <dir> 同步文件
oc <动作> -h 查看帮助
oc edit dc <name> 编辑dc兑现
oc delete dc <name> 删除对象
oc new-app tomcat/tomcat 部署容器应用
oc create -f <file_name> 创建对象
oc rollout latest dc /<dc_name> 发布应用
oc rollback <dc_name> -to-version=1 回滚应用
oc start-build <build_config_name> 触发器构建

Guess you like

Origin blog.csdn.net/foolere/article/details/131273720