Skip to content
Yuvraj 🧒
GithubLinkedinDatasherlockContact

Cloud Native Workspace in 5 Min

β€” kubernetes β€” 7 min read

In this blog post we will discuss some tools & heros of cloud native.CNCF ecosystem is growing day by day and community is doing their best to make a developer experience smooth in this ocean of tools. All the tools that we are discussing here follow Unix philosophy to be simple and composable.

Let's start with Arkade (ark for short) One stop CLI for kubernetes tools and apps. It’s written in Golang and Mentained by Alex Ellis and the OpenFaaS Community. Let's install it

➜ evalsocket βœ— curl -sLS https://dl.get-arkade.dev | sudo sh
Downloading package https://github.com/alexellis/arkade/releases/download/0.5.1/arkade-darwin as /tmp/arkade-darwin
Download complete.
Running with sufficient permissions to attempt to move arkade to /usr/local/bin
New version of arkade installed to /usr/local/bin
_ _
__ _ _ __| | ____ _ __| | ___
/ _` | '__| |/ / _` |/ _` |/ _ \
| (_| | | | < (_| | (_| | __/
\__,_|_| |_|\_\__,_|\__,_|\___|
Get Kubernetes apps the easy way
Version: 0.5.1
Git Commit: 3c3970eafdca83570d5b1b85902a4957f9dfba16
# Verify arkade cli
➜ evalsocket βœ— arkade --help
Usage:
arkade [flags]
arkade [command]
Available Commands:
get The get command downloads a tool
help Help about any command
info Find info about a Kubernetes app
install Install Kubernetes apps from helm charts or YAML files
update Print update instructions
version Print the version
Flags:
-h, --help help for arkade
Use "arkade [command] --help" for more information about a command.

Now we will install some tools that every developer needs in his daily life

# Helm helps you manage Kubernetes applications
➜ evalsocket βœ— arkade get helm
# kind runs a local Kubernetes cluster by using Docker containers as β€œnodes”
➜ evalsocket βœ— arkade get kind
# kubectl we used to to preety much everything with kubernetes cluster
➜ evalsocket βœ— arkade get kubectl

After Arkade It's time to install Krew(Krew is the package manager for kubectl plugins.).It is similar to tools like apt, dnf or brew. Today, over 70 kubectl plugins are available on Krew. It’s written in Golang and Mentained by Ahmet Alp Balkan. It's the part of kubernetes sig

# Check Platform Specific Method to install krew https://krew.sigs.k8s.io/docs/user-guide/setup/install/
➜ evalsocket βœ— set -x; cd "$(mktemp -d)" && curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.{tar.gz,yaml}" && \
tar zxvf krew.tar.gz && \
KREW=./krew-"$(uname | tr '[:upper:]' '[:lower:]')_amd64" && \
"$KREW" install --manifest=krew.yaml --archive=krew.tar.gz && \
"$KREW" update
➜ evalsocket βœ— export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
# Verify the Krew plugin
➜ evalsocket βœ— kubectl krew --help
You can invoke krew through kubectl: "kubectl krew [command]..."
Usage:
krew [command]
Available Commands:
help Help about any command
info Show information about a kubectl plugin
install Install kubectl plugins
list List installed kubectl plugins
search Discover kubectl plugins
uninstall Uninstall plugins
update Update the local copy of the plugin index
upgrade Upgrade installed plugins to newer versions
version Show krew version and diagnostics
Flags:
-h, --help help for krew
-v, --v Level number for the log level verbosity
Use "krew [command] --help" for more information about a command.

We will install some use full Krew plugin to make ready your base setup.

➜ evalsocket βœ— kubectl krew install ctx ns gke-credentials whoami who-can konfig images
# Now you can use any plugin that is available. For example ctx plugin is used for changing context no need to write kubectl command
➜ evalsocket βœ— kubectl ctx
minikube
➜ evalsocket βœ— kubectl ctx minikube
Switched to context "minikube".
Krew

Before exploring other tools let start your first cluster and deploy some application

➜ evalsocket βœ— kind create cluster
βœ“ Ensuring node image (kindest/node:v1.17.0) πŸ–Ό
βœ“ Preparing nodes πŸ“¦
βœ“ Writing configuration πŸ“œ
βœ“ Starting control-plane πŸ•ΉοΈ
βœ“ Installing CNI πŸ”Œ
βœ“ Installing StorageClass πŸ’Ύ
Set kubectl context to "kind-kind"
You can now use your cluster with:
kubectl cluster-info --context kind-kind
Not sure what to do next? πŸ˜… Check out https://kind.sigs.k8s.io/docs/user/quick-start/
➜ evalsocket βœ— kubectl get node
NAME STATUS ROLES AGE VERSION
kind-control-plane NotReady master 47s v1.17.0
# Install mongodb helm chart using arkade in default namespace
➜ evalsocket βœ— arkade install mongodb --namespace default
Dev Setup

Octant is Highly extensible platform for developers to better understand the complexity of Kubernetes clusters. It’s written in Golang and Mentained by Bryan Liles and VMware open source

# FOr other platform please check https://github.com/vmware-tanzu/octant
➜ evalsocket βœ— brew install octant
# Start the octant
➜ evalsocket βœ— octant
# Open http://127.0.0.1:7777/ for the dashboard

Dashboard Homepage. You can perform debuging with kubernetes resource without touching terminal in a developer friendly UI Octant

Resource Viewer. It's a nice feature that will help you to debug complex microservices package in an helm chart

Octant TGIK

Alternative of octant is K9s and KubeLens.

kapp is a simple deployment tool focused on the concept of "Kubernetes application" β€” a set of resources with the same label. Terraform Experience with YAML

# Install kapp
➜ evalsocket βœ— brew install kapp
# Install a dummy application to see how it works
➜ evalsocket βœ— kapp deploy -a kyverno -f https://github.com/nirmata/kyverno/raw/master/definitions/install.yaml
Target cluster 'https://127.0.0.1:32771' (nodes: kind-control-plane)
Changes
Namespace Name Kind Conds. Age Op Op st. Wait to Rs Ri
(cluster) clusterpolicies.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
^ clusterpolicyviolations.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
^ generaterequests.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
^ kyverno Namespace - 16h update - reconcile ok -
^ kyverno:customresources ClusterRole - 16h update - reconcile ok -
^ kyverno:customresources ClusterRoleBinding - 16h update - reconcile ok -
^ kyverno:generatecontroller ClusterRole - 16h update - reconcile ok -
^ kyverno:generatecontroller ClusterRoleBinding - 16h update - reconcile ok -
^ kyverno:policycontroller ClusterRole - 16h update - reconcile ok -
^ kyverno:policycontroller ClusterRoleBinding - 16h update - reconcile ok -
^ kyverno:policyviolations ClusterRole - 16h update - reconcile ok -
^ kyverno:userinfo ClusterRole - 16h update - reconcile ok -
^ kyverno:userinfo ClusterRoleBinding - 16h update - reconcile ok -
^ kyverno:view-clusterpolicyviolations ClusterRole - 16h update - reconcile ok -
^ kyverno:view-policyviolations ClusterRole - 16h update - reconcile ok -
^ kyverno:webhook ClusterRole - 16h update - reconcile ok -
^ kyverno:webhook ClusterRoleBinding - 16h update - reconcile ok -
^ policyviolations.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
kyverno init-config ConfigMap - 16h update - reconcile ok -
^ kyverno Deployment 2/2 t 16h update - reconcile ok -
^ kyverno-service-account ServiceAccount - 16h update - reconcile ok -
^ kyverno-svc Service - 16h update - reconcile ok -
Op: 0 create, 0 delete, 22 update, 0 noop
Wait to: 22 reconcile, 0 delete, 0 noop
Continue? [yN]: y
8:01:12PM: ---- applying 18 changes [0/22 done] ----
8:01:16PM: update clusterrolebinding/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
8:01:16PM: update clusterrolebinding/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
8:01:16PM: update clusterrolebinding/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
8:01:17PM: update clusterrole/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
8:01:17PM: update clusterrole/kyverno:view-policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
8:01:17PM: update clusterrolebinding/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
8:01:17PM: update clusterrole/kyverno:policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
8:01:17PM: update clusterrole/kyverno:view-clusterpolicyviolations (rbac.authorization.k8s.io/v1beta1) cluster
8:01:17PM: update clusterrole/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
8:01:18PM: update namespace/kyverno (v1) cluster
8:01:19PM: update customresourcedefinition/policyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:19PM: update clusterrole/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
8:01:19PM: update customresourcedefinition/clusterpolicies.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:20PM: update customresourcedefinition/clusterpolicyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:20PM: update clusterrole/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
8:01:20PM: update customresourcedefinition/generaterequests.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:20PM: update clusterrole/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
8:01:20PM: update clusterrolebinding/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
8:01:20PM: ---- waiting on 18 changes [0/22 done] ----
8:01:20PM: ok: reconcile clusterrolebinding/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
8:01:20PM: ok: reconcile clusterrolebinding/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
8:01:20PM: ok: reconcile clusterrole/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
8:01:20PM: ok: reconcile customresourcedefinition/clusterpolicies.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:20PM: ok: reconcile customresourcedefinition/policyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:21PM: ok: reconcile namespace/kyverno (v1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:view-policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
8:01:21PM: ok: reconcile customresourcedefinition/clusterpolicyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ok: reconcile customresourcedefinition/generaterequests.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
8:01:21PM: ok: reconcile clusterrolebinding/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
8:01:21PM: ok: reconcile clusterrolebinding/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ok: reconcile clusterrolebinding/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:view-clusterpolicyviolations (rbac.authorization.k8s.io/v1beta1) cluster
8:01:21PM: ok: reconcile clusterrole/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
8:01:21PM: ---- applying 2 changes [18/22 done] ----
8:01:22PM: update serviceaccount/kyverno-service-account (v1) namespace: kyverno
8:01:22PM: update configmap/init-config (v1) namespace: kyverno
8:01:22PM: ---- waiting on 2 changes [18/22 done] ----
8:01:22PM: ok: reconcile configmap/init-config (v1) namespace: kyverno
8:01:22PM: ok: reconcile serviceaccount/kyverno-service-account (v1) namespace: kyverno
8:01:22PM: ---- applying 2 changes [20/22 done] ----
8:01:25PM: update deployment/kyverno (apps/v1) namespace: kyverno
# deploy helm chart
➜ evalsocket βœ— kapp -y deploy -a my-chart -f <(helm template my-chart --values my-vals.yml)
# deploy kustomize output
➜ evalsocket βœ— kapp -y deploy -a my-app -f <(kustomize build ./my-app)
# Destroy your application
➜ evalsocket βœ— kapp delete -a kyverno
Kapp
© 2024 by Yuvraj 🧒. All rights reserved.
Theme by LekoArts