Skip to content
Yuvraj 🧒

Cloud Native Workspace in 5 Min

β€” kubernetes β€” 1 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

1➜ evalsocket βœ— curl -sLS https://dl.get-arkade.dev | sudo sh
2Downloading package https://github.com/alexellis/arkade/releases/download/0.5.1/arkade-darwin as /tmp/arkade-darwin
3Download complete.
4
5Running with sufficient permissions to attempt to move arkade to /usr/local/bin
6New version of arkade installed to /usr/local/bin
7 _ _
8 __ _ _ __| | ____ _ __| | ___
9 / _` | '__| |/ / _` |/ _` |/ _ \
10| (_| | | | < (_| | (_| | __/
11 \__,_|_| |_|\_\__,_|\__,_|\___|
12
13Get Kubernetes apps the easy way
14
15Version: 0.5.1
16Git Commit: 3c3970eafdca83570d5b1b85902a4957f9dfba16
17
18# Verify arkade cli
19➜ evalsocket βœ— arkade --help
20Usage:
21 arkade [flags]
22 arkade [command]
23
24Available Commands:
25 get The get command downloads a tool
26 help Help about any command
27 info Find info about a Kubernetes app
28 install Install Kubernetes apps from helm charts or YAML files
29 update Print update instructions
30 version Print the version
31
32Flags:
33 -h, --help help for arkade
34
35Use "arkade [command] --help" for more information about a command.

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

1# Helm helps you manage Kubernetes applications
2➜ evalsocket βœ— arkade get helm
3# kind runs a local Kubernetes cluster by using Docker containers as β€œnodes”
4➜ evalsocket βœ— arkade get kind
5# kubectl we used to to preety much everything with kubernetes cluster
6➜ 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

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

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

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

Krew

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

1➜ evalsocket βœ— kind create cluster
2 βœ“ Ensuring node image (kindest/node:v1.17.0) πŸ–Ό
3 βœ“ Preparing nodes πŸ“¦
4 βœ“ Writing configuration πŸ“œ
5 βœ“ Starting control-plane πŸ•ΉοΈ
6 βœ“ Installing CNI πŸ”Œ
7 βœ“ Installing StorageClass πŸ’Ύ
8Set kubectl context to "kind-kind"
9You can now use your cluster with:
10
11kubectl cluster-info --context kind-kind
12
13Not sure what to do next? πŸ˜… Check out https://kind.sigs.k8s.io/docs/user/quick-start/
14
15➜ evalsocket βœ— kubectl get node
16NAME STATUS ROLES AGE VERSION
17kind-control-plane NotReady master 47s v1.17.0
18
19# Install mongodb helm chart using arkade in default namespace
20➜ 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

1# FOr other platform please check https://github.com/vmware-tanzu/octant
2➜ evalsocket βœ— brew install octant
3
4# Start the octant
5➜ evalsocket βœ— octant
6# 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

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

1# Install kapp
2➜ evalsocket βœ— brew install kapp
3# Install a dummy application to see how it works
4➜ evalsocket βœ— kapp deploy -a kyverno -f https://github.com/nirmata/kyverno/raw/master/definitions/install.yaml
5Target cluster 'https://127.0.0.1:32771' (nodes: kind-control-plane)
6
7Changes
8
9Namespace Name Kind Conds. Age Op Op st. Wait to Rs Ri
10(cluster) clusterpolicies.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
11^ clusterpolicyviolations.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
12^ generaterequests.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
13^ kyverno Namespace - 16h update - reconcile ok -
14^ kyverno:customresources ClusterRole - 16h update - reconcile ok -
15^ kyverno:customresources ClusterRoleBinding - 16h update - reconcile ok -
16^ kyverno:generatecontroller ClusterRole - 16h update - reconcile ok -
17^ kyverno:generatecontroller ClusterRoleBinding - 16h update - reconcile ok -
18^ kyverno:policycontroller ClusterRole - 16h update - reconcile ok -
19^ kyverno:policycontroller ClusterRoleBinding - 16h update - reconcile ok -
20^ kyverno:policyviolations ClusterRole - 16h update - reconcile ok -
21^ kyverno:userinfo ClusterRole - 16h update - reconcile ok -
22^ kyverno:userinfo ClusterRoleBinding - 16h update - reconcile ok -
23^ kyverno:view-clusterpolicyviolations ClusterRole - 16h update - reconcile ok -
24^ kyverno:view-policyviolations ClusterRole - 16h update - reconcile ok -
25^ kyverno:webhook ClusterRole - 16h update - reconcile ok -
26^ kyverno:webhook ClusterRoleBinding - 16h update - reconcile ok -
27^ policyviolations.kyverno.io CustomResourceDefinition 3/3 t 16h update - reconcile ok -
28kyverno init-config ConfigMap - 16h update - reconcile ok -
29^ kyverno Deployment 2/2 t 16h update - reconcile ok -
30^ kyverno-service-account ServiceAccount - 16h update - reconcile ok -
31^ kyverno-svc Service - 16h update - reconcile ok -
32
33Op: 0 create, 0 delete, 22 update, 0 noop
34Wait to: 22 reconcile, 0 delete, 0 noop
35
36Continue? [yN]: y
37
388:01:12PM: ---- applying 18 changes [0/22 done] ----
398:01:16PM: update clusterrolebinding/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
408:01:16PM: update clusterrolebinding/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
418:01:16PM: update clusterrolebinding/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
428:01:17PM: update clusterrole/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
438:01:17PM: update clusterrole/kyverno:view-policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
448:01:17PM: update clusterrolebinding/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
458:01:17PM: update clusterrole/kyverno:policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
468:01:17PM: update clusterrole/kyverno:view-clusterpolicyviolations (rbac.authorization.k8s.io/v1beta1) cluster
478:01:17PM: update clusterrole/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
488:01:18PM: update namespace/kyverno (v1) cluster
498:01:19PM: update customresourcedefinition/policyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
508:01:19PM: update clusterrole/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
518:01:19PM: update customresourcedefinition/clusterpolicies.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
528:01:20PM: update customresourcedefinition/clusterpolicyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
538:01:20PM: update clusterrole/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
548:01:20PM: update customresourcedefinition/generaterequests.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
558:01:20PM: update clusterrole/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
568:01:20PM: update clusterrolebinding/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
578:01:20PM: ---- waiting on 18 changes [0/22 done] ----
588:01:20PM: ok: reconcile clusterrolebinding/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
598:01:20PM: ok: reconcile clusterrolebinding/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
608:01:20PM: ok: reconcile clusterrole/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
618:01:20PM: ok: reconcile customresourcedefinition/clusterpolicies.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
628:01:20PM: ok: reconcile customresourcedefinition/policyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
638:01:21PM: ok: reconcile namespace/kyverno (v1) cluster
648:01:21PM: ok: reconcile clusterrole/kyverno:view-policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
658:01:21PM: ok: reconcile customresourcedefinition/clusterpolicyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
668:01:21PM: ok: reconcile clusterrole/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster
678:01:21PM: ok: reconcile clusterrole/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
688:01:21PM: ok: reconcile customresourcedefinition/generaterequests.kyverno.io (apiextensions.k8s.io/v1beta1) cluster
698:01:21PM: ok: reconcile clusterrolebinding/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster
708:01:21PM: ok: reconcile clusterrole/kyverno:policyviolations (rbac.authorization.k8s.io/v1beta1) cluster
718:01:21PM: ok: reconcile clusterrolebinding/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster
728:01:21PM: ok: reconcile clusterrole/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
738:01:21PM: ok: reconcile clusterrolebinding/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster
748:01:21PM: ok: reconcile clusterrole/kyverno:view-clusterpolicyviolations (rbac.authorization.k8s.io/v1beta1) cluster
758:01:21PM: ok: reconcile clusterrole/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster
768:01:21PM: ---- applying 2 changes [18/22 done] ----
778:01:22PM: update serviceaccount/kyverno-service-account (v1) namespace: kyverno
788:01:22PM: update configmap/init-config (v1) namespace: kyverno
798:01:22PM: ---- waiting on 2 changes [18/22 done] ----
808:01:22PM: ok: reconcile configmap/init-config (v1) namespace: kyverno
818:01:22PM: ok: reconcile serviceaccount/kyverno-service-account (v1) namespace: kyverno
828:01:22PM: ---- applying 2 changes [20/22 done] ----
838:01:25PM: update deployment/kyverno (apps/v1) namespace: kyverno
84
85# deploy helm chart
86➜ evalsocket βœ— kapp -y deploy -a my-chart -f <(helm template my-chart --values my-vals.yml)
87# deploy kustomize output
88➜ evalsocket βœ— kapp -y deploy -a my-app -f <(kustomize build ./my-app)
89# Destroy your application
90➜ evalsocket βœ— kapp delete -a kyverno

Kapp

© 2021 by Yuvraj 🧒. All rights reserved.
Theme by LekoArts