安装和设置kubectl命令
Linux
[root@cx-- ~]# curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.13.5/bin/linux/amd64/kubectl
在~/.kube/目录下创建config文件
[root@cx-- ~]# chmod +x ./kubectl
[root@cx-- ~]# mv ./kubectl /usr/local/bin/kubectl
[root@cx-- ~]# mkdir ~/.kube/ [root@cx-- ~]# vim .kube/config
apiVersion: v1
kind: Config
clusters:
- name: "master138"
cluster:
server: "https://172.16.2.17/k8s/clusters/c-pqtft"
certificate-authority-data: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM3akNDQ\
WRhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFvTVJJd0VBWURWUVFLRXdsMGFHVXQKY\
21GdVkyZ3hFakFRQmdOVkJBTVRDV05oZEhSc1pTMWpZVEFlRncweE9UQTNNVEl4TkRFek16ZGFGd\
zB5T1RBMwpNRGt4TkRFek16ZGFNQ2d4RWpBUUJnTlZCQW9UQ1hSb1pTMXlZVzVqYURFU01CQUdBM\
VVFQXhNSlkyRjBkR3hsCkxXTmhNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ\
0tDQVFFQTFLaGU2QnN3bWhKMnVTNXgKNWJmWkRLZGNic0xIRXRhWlhRdjFiSzVUc0ozQjc1RnVUb\
GlzeTAyQ25LbVZZTytuTlY3SlAyS1lOSmRObFFMVQpkZHluN1dKaThOaEsyR1dyTCtQMXVoc3NtV\
XhLVU8xZmdSc04rMDE3TWFOcXk2cTlIV2xsQUpWZ3NHcnZoODIwCmRJakMrakNaRWs1NCtSOC83V\
WZIUldSSXNESXBGdExYSjBFcWJSaUt5cXJVUW9qK1lSaHJ5alpSRStpcjJ1eHAKeU5pUEdXNFpDU\
GtqS2UxUVFwSG1FdmxjTkpMWC9ML0JQN1NIeE1mYWc2eTBtR2EzdWlwczFlMGdBODVWcVNPSApCc\
WF6TEIzSzE3T0ZmT2dMODJTK3c1eFp3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0tRU5EIENFUlRJR\
klDQVRFLS0tLS0K" users:
- name: "user-4xdhx"
user:
token: "kubeconfig-user-4xdhx.c-pqtft:6vrjrpt8sbjpxs2bcq2dnhr4qljwhhfw4htl86pvgq4f9jw4m5rps4" contexts:
- name: "master138"
context:
user: "user-4xdhx"
cluster: "master138"
- name: "master138-cx--0008"
context:
user: "user-4xdhx"
cluster: "master138-cx--0008" current-context: "master138"
验证集群
[root@cx-- ~]# kubectl cluster-info
Kubernetes master is running at https://172.16.2.17/k8s/clusters/c-pqtft
KubeDNS is running at https://172.16.2.17/k8s/clusters/c-pqtft/api/v1/namespaces/kube-system/services/kube-dns/proxy To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
[root@cx-- ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
details-v1-68c7c8666d-sq7c7 / Running 17d
httpbin-776487d667-ctw9b / Running 13d
productpage-v1-54d799c966-5vlz6 / Running 17d
ratings-v1-8558d4458d-8bpr5 / Running 17d
reviews-v1-cb8655c75-679w9 / Running 17d
reviews-v2-7fc9bb6dcf-tjdqk / Running 17d
reviews-v3-c995979bc-8vkmg / Running 17d
支持多个集群,用户和身份验证机制
https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/
安装和设置kubectl命令的更多相关文章
- [转帖] k8s kubectl 命令行技巧
https://jimmysong.io/posts/kubectl-cheatsheet/ Kubectl Cheatsheet kubectl命令技巧大全Posted on November 3, ...
- Kubernetes集群管理工具kubectl命令技巧大全
一. kubectl概述 Kubectl是用于控制Kubernetes集群的命令行工具,通过kubectl能够对集群本身进行管理,并能够在集群上进行容器化应用的安装部署. kubectl命令的语法如下 ...
- K8S命令-Kubectl 命令大全
参考1:https://jimmysong.io/kubernetes-handbook/guide/kubectl-cheatsheet.html?h=kubectl Kubctl 命令是操作 ku ...
- dspmq dspmqver command not found(dspmq命令找不到,dspmqver主安装目录设置不正确
[root@rhv6-64b ~]# su - mqm -bash-4.1$ dspmq -bash: dspmq: command not found(dspmq命令找不到) -bash-4.1$ ...
- 使用二进制方式安装K8S时使用kubectl命令报错:The connection to the server localhost:8080 was refused - did you specify the right host or port?
解决思路: kubectl 默认从 ~/.kube/config 配置文件获取访问 kube-apiserver 地址.证书.用户名等信息,如果没有配置该文件,或者该文件个别参数配置出错,执行命令时出 ...
- Hadoop的安装与设置(1)
在Ubuntu下安装与设置Hadoop的主要过程. 1. 创建Hadoop用户 创建一个用户,用户名为hadoop,在home下创建该用户的主目录,就不详细介绍了. 2. 安装Java环境 下载Lin ...
- linux下MySQL安装及设置
转自:http://www.entage.net/1/viewspace-25420 1. 关于本文 本文将以MySQL 5.0.51为例,以CentOS 5为平台,讲述MySQL数据库的安装和 ...
- 在Ubuntu 12.04安装和设置Samba实现网上邻居共享
转载:http://www.startos.com/ubuntu/tips/2012031333097.html 有微小改动. Samba 是一款功能强大的共享工具,可以实现与win ...
- RESTheart安装与设置
作者:Maurizio Turatti, 最后在Feb 25, 2016时被 Andrea Di Cesare更新 安装与设置 1. 快速开始 Docker Vagrant Bare metal 2. ...
随机推荐
- 【HDOJ】 P2054 A == B ?
题目意思不太多解释,具体WA的情况可以举出一下特例 0 +0 0.00 0 +1 -2 +1.00 -1.00 +.2 -.2 .0 .1 等等 不过可以发现对上面的数据处理,可以分为以下几步 1.找 ...
- egrep 或与
' HEADERABC' .txt | .txt 'HEADERABC' .txt > .txt .txt > .txt ' HEADERABC' ' TAILER123' .txt &g ...
- 通过js渲染高层级DOM实现网页加水印
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- NX二次开发-UFUN获取工程图所有视图tag UF_DRAW_ask_views
#include <uf.h> #include <uf_draw.h> #include <uf_drf.h> #include <uf_obj.h> ...
- NX二次开发-UFUN获取边的光顺性UF_MODL_ask_edge_smoothness(找相切面)
#include <uf.h> #include <uf_modl.h> #include <uf_obj.h> UF_initialize(); //获取面的所有 ...
- 一幅图解决R语言绘制图例的各种问题
一幅图解决R语言绘制图例的各种问题 用R语言画图的小伙伴们有木有这样的感受,"命令写的很完整,运行没有报错,可图例藏哪去了?""图画的很美,怎么总是图例不协调?" ...
- Unity 如何修改 particle system 的 start color 属性
代码如下: ParticleSystem ps = GetComponent<ParticleSystem>(); var main = ps.main; var color = Colo ...
- CometOJ Contest #3 C
题目链接:https://cometoj.com/contest/38/problem/C?problem_id=1542&myself=0&result=0&page=1&a ...
- 剑指offer——25合并两个排序的链表
题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则. 题解: 使用普通方法,或者递归,注意新的头节点即可. //使用普通的合并方法 class S ...
- Python服务端工程师就业面试指导✍✍✍
Python服务端工程师就业面试指导 整个课程都看完了,这个课程的分享可以往下看,下面有链接,之前做java开发也做了一些年头,也分享下自己看这个视频的感受,单论单个知识点课程本身没问题,大家看的时 ...