Okteto : Kubernetes as a Service for Developers

If you don’t want to setup a k8s cluster locally or on the cloud.

But you still want to develop apps and deploy them to a DEV k8s, you may need to look into Okteto : https://cloud.okteto.com

1. Login to Okteto with your Github Account

Image for post
Image for post

2. Download KUBECONFIG file and Connect to the Cluster

Image for post
Image for post
Just after First Login

export the KUBECONFIG variable.

export KUBECONFIG=~/.kube/okteto-kube.config`

3. Download okteto CLI :

curl https://get.okteto.com -sSfL | sh

okteto command will be defined under “ /usr/local/bin/okteto”.

4. Run your first app

Download sample apps :

git clone https://github.com/abdennour/samples.git
cd samples/golang

Environment is Up !!:

okteto up

This command will automatically start an Okteto Environment :

— — 1 the name of your development environment,

— — 2 the docker image to use

— — 3 where to upload your code.

  • “okteto/golang:1" is a mutable image and it has capabilities not only to run the app but also to build it.
  • an rsync service is running to update the container with the last code changes.
  • Whenever you run okteto up , a new PVC will be created to persist that environment ( Check “kubectl get pvc” output at the end of this article).

And this is what you will see in the STDOUT of this command :

Installing dependencies...syncthing-Darwin-x86_64 18.30 MiB / 18.30 MiB [=============================================] 100.00% 10sDeployment hello-world doesn't exist in namespace abdennour. Do you want to create a new one? [y/n]: y✓  Persistent volume provisioned✓  Files synchronized✓  Okteto Environment activatedNamespace: abdennourName:      hello-worldForward:   8080 -> 8080           2345 -> 2345

And this is what you will see in the Okteto console :

Image for post
Image for post
The hello-world app is deployed

Visiting : https://hello-world-abdennour.cloud.okteto.net/

Image for post
Image for post

Environment is UP but app is not yet .🤔

App is UP !! :

Go to your terminal, as noticed okteto up opens an interactive shell.

Start the app by :

okteto> go run main.go

Navigate now again to your browser


Image for post
Image for post
App is UP

Keep changing your app and preview it directly on the cloud.

Happy kubing 😃 with Okteto!

5. Inspect Resources with Kubectl

Inspect resources created after this deployment : pods, deployment, svc , pvc and ingress .

➜  golang git:(master) ✗ k get podNAME                           READY   STATUS    RESTARTS   AGEhello-world-67645897dc-kqlxl   1/1     Running   0          44mokteto-hello-world-0           1/1     Running   0          29m
➜ golang git:(master) ✗ k get deploymentNAME READY UP-TO-DATE AVAILABLE AGEhello-world 1/1 1 1 44m➜ golang git:(master) ✗ k get svcNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEhello-world ClusterIP <none> 8080/TCP 44m➜ golang git:(master) ✗ k get pvcNAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGEpvc-0-okteto-hello-world-0 Bound pvc-3946b68f-ce66-11e9-98b5-42010a800173 10Gi RWO standard 47mpvc-1-okteto-hello-world-0 Bound pvc-3948cfeb-ce66-11e9-98b5-42010a800173 10Gi RWO standard 47mpvc-2-okteto-hello-world-0 Bound pvc-394c409c-ce66-11e9-98b5-42010a800173 10Gi RWO standard 47m➜ golang git:(master) ✗ k get ingressNAME HOSTS ADDRESS PORTS AGEokteto-hello-world hello-world-abdennour.cloud.okteto.net, 80, 443 44m

Note :

Okteto allows you to create multiple namespaces thru the Console (not kubectl). Furthermore, all namespaces that you will create will be suffixed by your username. (i.e. xxxx-username)

Written by

Software engineer, Cloud Architect, 5/5 AWS|GCP|PSM Certified, Owner of kubernetes.tn

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store