Okteto : Kubernetes as a Service for Developers

Abdennour Toumi
3 min readSep 3, 2019

--

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

2. Download KUBECONFIG file and Connect to the Cluster

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 :

The hello-world app is deployed

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

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

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

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 10.0.11.75 <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 35.192.221.22,35.226.62.75 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)

--

--

Abdennour Toumi

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