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 shDownloading package https://github.com/alexellis/arkade/releases/download/0.5.1/arkade-darwin as /tmp/arkade-darwinDownload complete.
Running with sufficient permissions to attempt to move arkade to /usr/local/binNew version of arkade installed to /usr/local/bin _ _ __ _ _ __| | ____ _ __| | ___ / _` | '__| |/ / _` |/ _` |/ _ \| (_| | | | < (_| | (_| | __/ \__,_|_| |_|\_\__,_|\__,_|\___|
Get Kubernetes apps the easy way
Version: 0.5.1Git Commit: 3c3970eafdca83570d5b1b85902a4957f9dfba16
# Verify arkade cliβ evalsocket β arkade --helpUsage: 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 --helpYou 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 ctxminikubeβ evalsocket β kubectl ctx minikubeSwitched to context "minikube".
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 nodeNAME STATUS ROLES AGE VERSIONkind-control-plane NotReady master 47s v1.17.0
# Install mongodb helm chart using arkade in default namespaceβ evalsocket β arkade install mongodb --namespace default
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
Resource Viewer. It's a nice feature that will help you to debug complex microservices package in an helm chart
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.yamlTarget 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 noopWait 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) cluster8:01:16PM: update clusterrolebinding/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster8:01:16PM: update clusterrolebinding/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster8:01:17PM: update clusterrole/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster8:01:17PM: update clusterrole/kyverno:view-policyviolations (rbac.authorization.k8s.io/v1beta1) cluster8:01:17PM: update clusterrolebinding/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster8:01:17PM: update clusterrole/kyverno:policyviolations (rbac.authorization.k8s.io/v1beta1) cluster8:01:17PM: update clusterrole/kyverno:view-clusterpolicyviolations (rbac.authorization.k8s.io/v1beta1) cluster8:01:17PM: update clusterrole/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster8:01:18PM: update namespace/kyverno (v1) cluster8:01:19PM: update customresourcedefinition/policyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:19PM: update clusterrole/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster8:01:19PM: update customresourcedefinition/clusterpolicies.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:20PM: update customresourcedefinition/clusterpolicyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:20PM: update clusterrole/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster8:01:20PM: update customresourcedefinition/generaterequests.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:20PM: update clusterrole/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster8:01:20PM: update clusterrolebinding/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster8:01:20PM: ---- waiting on 18 changes [0/22 done] ----8:01:20PM: ok: reconcile clusterrolebinding/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster8:01:20PM: ok: reconcile clusterrolebinding/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster8:01:20PM: ok: reconcile clusterrole/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster8:01:20PM: ok: reconcile customresourcedefinition/clusterpolicies.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:20PM: ok: reconcile customresourcedefinition/policyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:21PM: ok: reconcile namespace/kyverno (v1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:view-policyviolations (rbac.authorization.k8s.io/v1beta1) cluster8:01:21PM: ok: reconcile customresourcedefinition/clusterpolicyviolations.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:generatecontroller (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ok: reconcile customresourcedefinition/generaterequests.kyverno.io (apiextensions.k8s.io/v1beta1) cluster8:01:21PM: ok: reconcile clusterrolebinding/kyverno:policycontroller (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:policyviolations (rbac.authorization.k8s.io/v1beta1) cluster8:01:21PM: ok: reconcile clusterrolebinding/kyverno:webhook (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ok: reconcile clusterrolebinding/kyverno:userinfo (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:view-clusterpolicyviolations (rbac.authorization.k8s.io/v1beta1) cluster8:01:21PM: ok: reconcile clusterrole/kyverno:customresources (rbac.authorization.k8s.io/v1) cluster8:01:21PM: ---- applying 2 changes [18/22 done] ----8:01:22PM: update serviceaccount/kyverno-service-account (v1) namespace: kyverno8:01:22PM: update configmap/init-config (v1) namespace: kyverno8:01:22PM: ---- waiting on 2 changes [18/22 done] ----8:01:22PM: ok: reconcile configmap/init-config (v1) namespace: kyverno8:01:22PM: ok: reconcile serviceaccount/kyverno-service-account (v1) namespace: kyverno8: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