Objective
The OVHcloud Managed Kubernetes service provides you with access to Kubernetes clusters, without the hassle of installing or operating them.
This guide will cover how to recover the kubectl
configuration file to interact with an OVHcloud Managed Kubernetes cluster.
Requirements
- You must have an OVHcloud Managed Kubernetes cluster.
- You must have the kubectl command-line tool installed.
You can find the detailed installation instructions for kubectl
in Kubernetes’ official documentation.
Instructions
Step 1 - Configure the default settings for kubectl
First, log in to the OVH Control Panel, open the ‘Cloud’ tab, and click on the ‘Containers and Orchestration’ menu. Click on the cluster on which you want to configure kubectl
:
Then, download the kubectl
configuration file.
If you want to use this configuration file by default in kubectl
, you can save it with the filename config
in the $HOME/.kube
directory. Alternatively, you can place it in your working directory, with either the KUBECONFIG
environment variable or the --kubeconfig
flag.
In this example, we are using the environment variable method.
For MacOS or Linux:
Type the following command into your terminal:
# export KUBECONFIG=./kube-config
For Windows :
- From the Desktop, right-click the bottom-left corner of the screen to get the Power User Tasks Menu.
- In this menu, click System.
In Windows 10, you may need to scroll down to the Related settings section and click the System info link. In the System window that opens, click the Advanced system settings link in the left-hand column.
- In the System Properties window, click on the Advanced tab, then click the Environment Variables button near the bottom.
- In the window that opens (pictured below), add a new variable,
KUBECONFIG
, with the path to thekube-config
file as its value.
You can also add the variable for the current shell process with this command :
# set KUBECONFIG=kube-config
Step 2 - Verify that kubectl can connect to the cluster
You can verify that kubectl
is able to interact with the cluster by using it to send a cluster-info
command:
# kubectl cluster-info
The cluster should return a response with some key information about itself:
# kubectl cluster-info
Kubernetes master is running at https://******.c1.gra.k8s.ovh.net
KubeDNS is running at https://******.c1.gra.k8s.ovh.net/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use:
# kubectl cluster-info dump
Go further
To deploy your first application on your Kubernetes cluster, we suggest you refer to our guide to Deploying an application.