Okteto Enterprise is a developer platform for microservices, powered by Kubernetes. After installing Okteto Enterprise in your Civo Cluster, you’ll be able to:
- Deploy your applications and remote development environments with one click
- Visualize your application's health via Okteto's developer dashboard
- Create Kubernetes namespaces directly from the UI
- Develop directly in your cluster when using it along with the Okteto CLI
- Increase your computer's battery life by moving all the heavy processing to your cluster
- Automatically create preview environments for all your pull requests
Okteto Enterprise reduces most of the friction that comes from developing cloud-native applications so you can focus on building value. When you add Okteto to Civo, the fastest Kubernetes provider available, you'll be deploying development environments in Kubernetes in seconds.
This guide will show you how to install the single user version of Okteto Enterprise. For the full instance, follow this guide.
Let's get started
Okteto Enterprise is available in the Civo Marketplace, so installing it is as easy as clicking a few buttons:
Log in to your Civo Account at https://www.civo.com and click on the Kubernetes section on the sidebar on the left. Click on the "Create new cluster" button to configure your new cluster.
I'm going to use the following options:
- Name: okteto
- How many nodes? 3
- Select Size: Large
In the "Marketplace" section, click on the "Management" tab and select "Okteto Enterprise"
Click on "Create Cluster" at the bottom to create your cluster. The page will show details of the cluster as it's built.
Accessing Okteto Enterprise
Once your cluster is built, scroll up the page to get your cluster's DNS name. You can copy it to the clipboard by clicking the entry.
Open a web browser and navigate to https://okteto.{your-civo-dns.k8s.civo.com} to get to the Okteto Enterprise UI.
You'll need to provide an access key to log in. To get the access key, go back to the Civo UI, click on the Installed Applications tab, select Okteto Enterprise, and copy the "Access Key" value from there.
Head back to the Okteto login page, paste the access key, and click the "Log in" button.
Deploy your development environment
Once you have access to your own instance of Okteto Enterprise, it's time to deploy your first development environment. For this tutorial, we're going to use our demo application, but you can use any application with Okteto.
Click on the deploy button, and in the dialog, paste the following URL: https://github.com/okteto/movies
After a few seconds, your own version of the Movies application will be up and running. Okteto will automatically clone the code, build and push the necessary containers, and deploy the application. It will be ready to go once its components reach the Running state. The Okteto Cloud dashboard is designed to be developer-friendly, so it gives you instant feedback about your application endpoints, logs, errors, and more.
Now click on the application's endpoint of the frontend component to access the Movies App.
You should see something like this:
Cool no 😎? But ooh... seems like we have a bug in our application 🙀. The list of Movies and the list of Continue watching for Cindy are the same. Let's work on a fix now!
Develop in Kubernetes with Okteto
Now that we have our development environment running in our cluster, we can use it for development.
The first thing you need to do is to install the Okteto CLI:
$ curl https://get.okteto.com -sSfL | sh
Not on Linux or Mac? Follow our installation instructions here.
Once the CLI has been installed, you'll need to log in to your cluster. To do this, you'll first need to create a Personal Access Token.
Go to your Okteto Enterprise instance -> Settings, and click on the "New Token" button. Make sure to save the token, since it's only displayed once.
Run the following command, using the token you generated in the previous step.
$ okteto login https://okteto.{your-civo-dns.k8s.civo.com} --token {your-token}
Clone the repository with the source code of the Movies App, and navigate to the API folder:
$ git clone https://github.com/okteto/movies
$ cd movies/api
Run "okteto up" to activate your development environment:
$ okteto up
✓ Development container activated
✓ Files synchronized
Namespace: cindy
Name: api
Forward: 8080 -> 8080
9229 -> 9229
Welcome to your development container. Happy coding!
okteto>
While your development environment is active, the following things are happening:
- A development container with all your tools replaces the API service of the movies application
- A remote terminal is started in your development container
- Any change you make to your local files will be automatically synchronized to your remote development environment
Your development container inherits all the configurations of your application. For example, the database password is available via an environment variable. To check it out, execute the following command in the development container shell:
okteto> env | grep MONGODB_PASSWORD
MONGODB_PASSWORD=Password!1@2
Go to the remote terminal, and start the API service by executing the command below:
okteto> yarn start
yarn run v1.19.1
$ nodemon server.js
[nodemon] 1.19.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] starting `node server.js`
Server running on port 8080.
Go back to the browser and reload the Movies App. Check your remote terminal and see how the traffic now goes through your development container:
Server running on port 8080.
GET /api/movies
GET /api/watching
Let's fix our bug. Open the server.js
file in your favorite local IDE and modify line 43 to query the watching
collection instead of movies
:
Before:
db.collection('movies').find().toArray( (err, results) =>{
After:
db.collection('watching').find().toArray( (err, results) =>{
Save your changes. Okteto will automatically synchronize your changes to your development container. Take a look at the development container shell and notice how the changes are detected by nodemon
and automatically hot reloaded.
[nodemon] restarting due to changes...
[nodemon] starting node server.js
Server running on port 8080.
Go back to the browser and reload the Movies App. Your code fixes were instantly applied! No commit, build, or push required 😎.
The link to your version of the movies app is publicly available. This means that at any time in the development process, you can share that with anybody else in your team and get instant validation.
Conclusion
Okteto gives you all the tools you need to start developing your applications directly in your Kubernetes cluster. Instead of wasting time and resources installing local dependencies and running your entire stack locally, Okteto and Civo help you go faster by moving your development environment to Kubernetes. And this is just the tip of the iceberg.
Ready to give it a try? Head over to Civo and deploy your personal instance of Okteto Enterprise 🚀.