Okteto gives you instant cloud environments to code and collaborate in your Kubernetes cluster. Write code using your favorite IDE, and see the results directly in the cloud. No commit or push required.
This tutorial will have you developing a Python app directly in the cloud in less than 5 minutes. Hang on for a bit longer to learn more about the power of Okteto.
While you’re going through this tutorial, why don’t you join Okteto’s slack community and say hi 🤙?
You’ll use the CLI to create an account in Okteto, download your Kubernetes credentials, activate your namespaces and manage your Okteto Environments.
Install the Okteto CLI by running the following command in your local terminal:
curl https://get.okteto.com -sSfL | sh
wget https://downloads.okteto.com/cli/okteto-Windows-x86_64 -OutFile c:\windows\system32\okteto.exe
Using an existing Kubernetes cluster?
It is possible to use Okteto with an existing cluster. If you’re interested in that scenario, jump to step 4 of the guide.
okteto login command to create and initialize your Okteto account.
When you create an account in Okteto, a service account, namespace, and credentials will be automatically created for you in Okteto’s multi-tenant kubernetes cluster. These resources are configured automatically to include network policies, quotas, pod security policies, admission webhooks, roles, role bindings and limit ranges to give you the best possible development experience.
Once the login process is completed, open your browser and go to https://cloud.okteto.com. you should now see your empty personal namespace, ready to create new resources.
Run the following command to activate your new personal namespace:
okteto namespacecommand lets you easily change your Kubernetes context. If no namespace is provided, the command will switch to your Okteto personal namespace.
Get a local version of the sample application by executing the following commands in your local terminal:
git clone https://github.com/okteto/samples
You now have a functioning git repository that contains a simple python application and a
requirements.txt, which is used by Python’s dependency manager,
manifest/ directory you also have raw Kubernetes manifests that we will use in this guide to deploy the application in the cluster. Okteto works however independently of your common deployment practices or tools.
If you don’t have
kubectlinstalled, follow this guide.
Run the Voting app by executing:
kubectl apply -f manifests
Start your Okteto Environment by running the following command in your local terminal:
Deployment 'vote' doesn't exist. Do you want to create a new one? [y/n]: y
okteto upcommand will automatically start an Okteto Environment. It will also start a file synchronization service to keep your changes up to date between your local filesystem and your Okteto Environment.
Your application is now ready. Open your browser and go the URL of the application. You can get the URL by logging into Okteto and clicking in the application’s endpoint.
Place a few votes on your favorite animal to try out the application. Congratulations, you just launched your first Okteto Environment 🚀!
Now things get more exciting. Open
app.py in your favorite local IDE and modify the
getOptions function with the following code, and save your file:
Go back to the terminal and notice that flask already detected the code changes and reloaded your application.
Go back to the browser, and reload the page. Notice how your changes are instantly applied. No commit, build or push required 😎!
okteto up command by pressing
Ctrl + C and run the following commands to remove the resources created by this guide:
kubectl delete -f manifests
You now know how easy you can do efficient development in the cloud.
okteto.yml file in the sample folder. Okteto uses that manifest to determine the name of your Okteto Environment, the docker image to use and where to upload your code. Check the Okteto manifest docs to customize your Okteto Environments with your own dev tools, images and dependencies.