Short Names for Resources
First, identify the short names for key resources such as Deployments, ReplicaSets, CronJobs, and Custom Resource Definitions (CRDs). Run the following command:- Deployments: deploy
- ReplicaSets: rs
- CronJobs: cj
- Custom Resource Definitions: crd (or crds)
Use the output of
kubectl api-resources to quickly reference the abbreviated names in your commands.Determining the API Group for a Resource
To determine which API group a resource belongs to—for example, the Job resource—execute:Finding the Preferred Version for a Specific API Group
Next, find the preferred version for theauthorization.k8s.io API group by following these steps:
-
Start a Local API Proxy:
Run the following command to create a local proxy to the Kubernetes API server: -
Query the API Group Details:
With the proxy running in the background, usecurlto fetch the API group’s details:
authorization.k8s.io is v1.
Enabling the v1alpha1 Version for RBAC.authorization.k8s.io
To enable thev1alpha1 version for the RBAC.authorization.k8s.io API group on the control plane node, perform the following steps:
-
Backup the Current Manifest:
The kube-apiserver manifest is located at/etc/kubernetes/manifests/kube-apiserver.yaml. Back it up with: -
Modify the Manifest:
Open the manifest file in your preferred text editor. Scroll down to the section containing command-line arguments and add the following flag at the bottom of the list:Below is an excerpt from the modified section: -
Verify the Update:
After saving the changes, the kube-apiserver pod will automatically restart. Confirm its status by running:Initially, the API server pod might display as Pending, but it should soon change to Running.
Always back up your kube-apiserver manifest before making any modifications to ensure you can revert changes if needed.
Installing the kubectl-convert Plugin
The kubectl-convert plugin is a versatile tool to convert manifest files between different API versions. Follow these steps to install it on the control plane node:-
Download the Plugin:
Retrieve the binary using the commands below: -
Make the Binary Executable and Move It:
Change its permissions and move it to/usr/local/binwith these commands: -
Verify the Installation:
Execute the help command to ensure the plugin is installed correctly:
Converting an Ingress Manifest
Finally, update an existing Ingress manifest from the deprecated API version (v1beta1) to the current networking.k8s.io/v1. Follow these steps:
-
Convert the Manifest:
The old ingress manifest is located at/root/ingress-old.yaml. Convert the API version using the following command:This command creates a new file namedingress-new.yamlwith the updated API version. -
Apply the New Manifest:
Deploy the updated Ingress configuration by running: