Table of Contents
In this article, I will take you through the steps to install Kyverno CLI on Linux Using 7 Easy Steps. Kyverno CLI is a command line tool to validate and test policy behavior to the resources before deploying it to a kubernetes cluster. The CLI tool can be easily used in CI/CD pipeline to ensure the resources getting deployed follows the required kubernetes standard policy. This tool can be installed as a standalone tool as well as a plugin using kubectl krew plugin manager. Here we are going to install Kyverno CLI as a plugin using kubectl krew plugin manager. More on official website.
How to Install Kyverno CLI on Linux Using 7 Easy Steps
Also Read: Solved "error loading config file: yaml : line: did not find expected key"
Step 1: Prerequisites
a) You should have a running Linux Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have kubectl krew plugin manager installed in your System. Check How to Install Krew Plugin Manager for Kubectl CLI on Linux to know more about the installation steps.
Step 2: Update Your Server
In the first step, you need update your system packages to the latest version by using any of the below command depending on the linux distribution you are currently using.
a) On Ubuntu/Debian
If you are using a ubuntu/debian based system then you need to use sudo apt update && sudo apt upgrade
command as shown below.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
b) On RHEL/CentOS
If you are using a RHEL/CentOS based system then you need to use sudo yum update && sudo yum upgrade
or sudo dnf update && sudo dnf upgrade
command as shown below.
[cyberithub@centos:~$] sudo yum update && sudo yum upgrade
Step 3: Search Kyverno CLI
You can search Kyverno plugin from the available plugin list by using kubectl krew search | grep -i kyverno
command as shown below.
cyberithub@ubuntu:~$ kubectl krew search | grep -i kyverno kyverno Kyverno is a policy engine for kubernetes no
Step 4: Check Info
You can also check complete information about Kyverno before installing into your system by using kubectl krew info kyverno
command as shown below. This will show some important information like URI, available version and description.
cyberithub@ubuntu:~$ kubectl krew info kyverno NAME: kyverno INDEX: default URI: https://github.com/kyverno/kyverno/releases/download/v1.9.2/kyverno-cli_v1.9.2_linux_x86_64.tar.gz SHA256: bb46700e314d19fecbfad735d0615fab475ccf913deaea28b656620b147c2204 VERSION: v1.9.2 HOMEPAGE: https://github.com/kyverno/kyverno DESCRIPTION: Kyverno is used to test kyverno policies and apply policies to resources files CAVEATS: \ | The plugin requires access to create Policy and CustomResources /
Step 5: Install Kyverno CLI
To install Kyverno CLI as a plugin using krew plugin manager, you need to use kubectl krew install kyverno
command as shown below.
cyberithub@ubuntu:~$ kubectl krew install kyverno Updated the local copy of plugin index. New plugins available: * kopilot Installing plugin: kyverno Installed plugin: kyverno \ | Use this plugin: | kubectl kyverno | Documentation: | https://github.com/kyverno/kyverno | Caveats: | \ | | The plugin requires access to create Policy and CustomResources | / / WARNING: You installed plugin "kyverno" from the krew-index plugin repository. These plugins are not audited for security by the Krew maintainers. Run them at your own risk.
Step 6: Check Version
After successful installation, you can check the current installed version by using kubectl kyverno version
command as shown below.
cyberithub@ubuntu:~$ kubectl kyverno version Version: 1.9.2 Time: 2023-03-22T04:00:43Z Git commit ID: 4dbffc57a124d14e681874b9839a8c14a41edfe0
Step 7: Uninstall Kyverno CLI
Once you are done using Kyverno CLI, you can choose to uninstall it from your system by using kubectl krew uninstall kyverno
command as shown below.
cyberithub@ubuntu:~$ kubectl krew uninstall kyverno Uninstalled plugin: kyverno