# 指定命名空间为 test 发布Deployment.yaml文件,配置文件为当前目录的news集群
kubectl --kubeconfig=news -n devops_test apply -f Deployment.yaml
# 查询 news集群中命名空间test是否存在
kubectl --kubeconfig=news get namespace|grep test
# 在news集群中创建test2 命名空间
kubectl --kubeconfig=news create  namespace test2
# 查看news集群中的存储类PVC
kubectl --kubeconfig=news get sc
# 查看news集群中test命名空间的存储PV名称
kubectl --kubeconfig=news get pvc -n test
# 查看news集群中工作节点worker的IP
kubectl --kubeconfig=news get nodes -o wide|grep worker
# 指定命名空间为 test 发布Deployment.yaml文件,配置文件为当前目录的news集群 
kubectl --kubeconfig=news -n devops_test apply -f Deployment.yaml
# 查询 news集群中命名空间test是否存在
kubectl --kubeconfig=news get namespace|grep test
# 在news集群中创建test2 命名空间

kubectl --kubeconfig=news create  namespace test2
# 在RANCHER中登录命名空间--项目
# 登录RACNHER 用户--API&KEYS中申请,c-cg9hs:p-9zhs6测试与开发集群默认项目ID ,c-r29d2:p-zhs7h 生产与预发环境的项目ID
/usr/local/bin/rancher login  https://rancherpro.astoutiao.com/v3 --token token-qdvhx:z4t7whzcc98bg5j5sbjcl8pdbzx4htr5bw4g47gwmwrw4zv6xr6qtz --context c-cg9hs:p-9zhs6
#RANCHER创建命名空间,注意所在的项目为当前登录的项目
rancher namespaces create k8s3
#RANCHER创建项目,注意创建的集群为当前登录的集群
rancher projects create ls0
#RANCHER 项目ID查看
rancher projects ls
#RANCHER当前集群查看,*为当前登录的集群
rancher clusters ls 
# 查看news集群中的存储类PVC
kubectl --kubeconfig=news get sc
# 查看news集群中test命名空间的存储PV名称
kubectl --kubeconfig=news get pvc -n test
# 查看news集群中工作节点worker的IP
kubectl --kubeconfig=news get nodes -o wide|grep worker
#获取DOCKER镜像库项目列表
curl -s -u "admin:Hik12345+" -X GET "https://reg.astoutiao.com/api/projects?"|grep "\"name"|grep testrpo4|awk -F '"' '{print $4}'|wc |awk '{print $1}'
#DOCKER镜像库创建项目
curl -u "admin:Hik12345+" -X POST -H "Content-Type: application/json" "https://reg.astoutiao.com/api/projects" -d @createproject.json 

curl -u "admin:Hik12345+" -X POST -H "Content-Type: application/json" "https://reg.astoutiao.com/api/projects" --data '{"project_name":"testpro6","public":0}'
# 创建项目的JSON文件内容,project_name项目名,public 私有项目。
cat createproject.json {"project_name":"testpro","public":0}
作者:Jeebiz  创建时间:2019-12-20 17:10
 更新时间:2024-08-02 14:28