通过kubectl管理集群

<p class="shortdesc">如果您需要从客户端计算机连接集群,可以使用Kubernetes命令行客户端kubectl。本文主要为您介绍如何通过kubectl连接集群。</p> <section class="section prereq" id="manage_clusters_kubectl__prereq_scm_gcc_gsb"><div class="tasklabel"><h2 class="doc-tairway">前提条件</h2></div> <ul class="ul" id="manage_clusters_kubectl__ul_ymp_gcc_gsb"> <li class="li">您已成功创建Serverless集群,可参考<a class="xref" href="/ssr/help/management/PKS/Serverless.quickstart.create_serverless_cluster" target="_blank" rel="external noopener">创建Serverless集群</a>。</li> <li class="li">您已下载kubectl客户端并进行安装和设置,具体请参考 <a class="xref" href="https://kubernetes.io/docs/tasks/tools/?spm=5176.2020520152.0.0.21ea16ddXXcWvR" target="_blank" rel="external noopener">安装和设置kubectl</a>。</li> </ul> </section> <section class="section attention" id="manage_clusters_kubectl__attention_llr_bdw_n5b"><div class="tasklabel"><h2 class="doc-tairway">注意事项</h2></div> <p class="p">仅限有集群操作权限的账号使用,例如主账号、被授予CaaSFullAccess或Administrator的子账号等。</p> </section> <section id="manage_clusters_kubectl__steps_std_bdw_n5b"><div class="tasklabel"><h2 class="doc-tairway">操作步骤</h2></div><ol class="ol steps" id="manage_clusters_kubectl__steps_std_bdw_n5b"><li class="li step stepexpand"> <span class="ph cmd">登录<a class="xref" href="https://www.ocftcloud.com/console/pks/cluster" target="_blank" rel="external noopener">容器服务CaaS Serverless集群控制台</a>。</span> </li><li class="li step stepexpand"> <span class="ph cmd">单击左侧导航栏<span class="ph uicontrol">集群</span>,进入<span class="ph uicontrol">集群列表</span>页面。</span> </li><li class="li step stepexpand"> <span class="ph cmd">在目标地域中,单击目标<span class="ph uicontrol">集群名称</span>。</span> </li><li class="li step stepexpand"> <span class="ph cmd">在<span class="ph uicontrol">集群信息</span>页面,选择<span class="ph uicontrol">集群连接信息</span>页签。</span> </li><li class="li step stepexpand"> <span class="ph cmd">单击<span class="ph uicontrol">复制</span>,将内容复制到本地计算机的。$HOME/.kube/config(即kubeconfig所在位置)。</span> <div class="itemgroup info"> <img class="image" id="manage_clusters_kubectl__image_m11_w5y_mtb" src="https://obs-cn-shanghai.fincloud.pinganyun.com/pacloud/20222012160841-15530c0c95a5.png" width="600"> </div> </li></ol></section> <section class="section result" id="manage_clusters_kubectl__result_ttd_bdw_n5b"><div class="tasklabel"><h2 class="doc-tairway">执行结果</h2></div> <p class="p">kubeconfig文件配置完成后,即可使用kubectl命令从本地计算机访问您创建的Serverless集群。</p> </section>
以上内容是否解决了您的问题?
请补全提交信息!
联系我们

电话咨询

400-151-8800

邮件咨询

fincloud@ocft.com

在线客服

工单支持

解决云产品相关技术问题