Experimenting with Deno for Easier Kubernetes Deployments

Rate this content
Bookmark

As we all know, dealing with Kubernetes YAML is not very intuitive (especially for those just getting starting) and the more resources and dependencies are added the messier and more complex the process becomes. In this talk, we'll explore how we can use Typescript and Deno to bring typing, composition, code-reuse, and testing as an alternative to YAML - that doesn't include these capabilities, all while still remaining declarative and easy to use.

Yshay Yaacobi
Yshay Yaacobi
31 min
25 Mar, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The Talk discusses using Dino and TypeScript to simplify writing and managing Kubernetes YAML configurations. It explores the challenges of working with large YAML files and introduces a unique solution. The Talk also highlights the features and benefits of Deno, such as its secure runtime and powerful typing capabilities. It demonstrates how Deno can be used to create and modify Kubernetes objects, and emphasizes the advantages of using a general-purpose language for configuration. The Talk concludes by discussing the potential applications of this approach beyond Kubernetes deployments.

1. Introduction to Dino and YAML in Kubernetes

Short description:

I'm going to talk about how we can use Dino to define our Kubernetes deployment in an easier way. Let's talk about YAML and its challenges. Kubernetes YAMLs are huge and complex, making manual writing difficult. Today, we'll discuss how to write YAMLs easier using DNO and TypeScript. I'm a cofounder of Lifecycle and an open source maintainer of Tweak. Lifecycle is a collaboration tool for development teams. We'll also explore how resources in Kubernetes work.

Hi, everyone. I'm Ishai. I'm the CTO of Lifecycle. Today I'm going to talk about how we can use Dino to define our Kubernetes deployment in a much more easier way than what we are usually doing.

To give some context, let's talk about YAML. Because Kubernetes is basically, like, all the configuration of Kubernetes is like this big, giant YAML file. And you probably, like, even if you didn't use Kubernetes, you know the YAML files from other places, like from GitHub Actions or from Docker Compose or CloudFormation. And basically, like, every tool, I mean, so many tools, like, in the DevOps ecosystem, are using YAML to define this configuration. And to be honest, for me, the first time I encountered this YAML file, it was terrible. I didn't, I mean, it wasn't convenient, like, copying from different YAMLs and merging them, and the indentation was weird and, like, DRA object differences. But I got used to that. And I will get, I'm, like, writing lots of YAMLs, and it works well. But the thing is that Kubernetes YAMLs, they're like, huge and complex, and there are so many of them. Which in this case, like, writing the YAMLs manually simply doesn't cut it in terms of, like, scale and correctness and even, like, fun and sanity.

So, today I'm going to talk about how we can write these YAMLs easier and more specifically, how we can do it with using DNO and TypeScript.

A few words about myself. As I mentioned, I'm a cofounder of Lifecycle. I'm a software engineer. I've used Kubernetes in the past five years. I'm also open source maintainer of Tweak. It's a Cloud native feature management solution. Two words on Lifecycle, it's a collaboration tools for development teams based on a like previous environment. It's a product in public beta that we launched like a few weeks ago, and we are very excited about it. You are welcome to check it out on Lifecycle.io.

Okay, so, what's on the agenda today? We are going to look at Kubernetes. We are going to define the same configuration in DNO, and we'll summarize. A few words about how resources in Kubernetes works. Basically, the idea is that we have the Kubernetes users, which can be developers or administrators. They are pushing a definition to the API server using YAML, and we have the controllers of Kubernetes that make all the magic happening. Now, these resources can be everything from a cron job, or a network thing, or a volume, or a bucket.

2. Introduction to YAML and Kubernetes Resources

Short description:

Kubernetes is vast and awesome. Everything is described with YAML, making it extensible and enabling the creation of custom resources. I'll show a naive use case with a Tetris application and demonstrate how to run and delete it. Then, I'll explain a naive definition of a service using a deployment object, which is more powerful than a pod.

It's really vast and it's pretty awesome. I mean, it's really one of the selling points of Kubernetes, in my opinion. Everything is data, everything is resource. Every resource is described with YAML. It's extensible, so we can have custom resources, and we really have those kind of things for monitoring, or for scaling, or for platform, like a build or CI stuff. And this ecosystem of Kubernetes is huge, and everything is defined in YAML. So it's pretty amazing.

So I'm going to show how these YAMLs look like in a very naive use cases. So we'll be like on the same page of what we are trying to solve in this kind of YAMLs. So the first example I'm going to show an application that is like a Tetris application. We can say that we have the definition of Kubernetes. Every resource has the version of the group of this resource, the API version it's called in Kubernetes. The kind, in this case, is a pod. A pod is simply compute units that run containers. And if I want to run it, I'm using the Kubernetes CLI and I'm just running it. I either have like a working Kubernetes cluster with all of the subgroups. It's a real server. So, we can see these examples live. So, I run the Tetris application. And basically, we now have a container that runs Tetris. It's not very useful, because I want to interact with it. So, I'm going to delete this definition. The same way, instead of applying the file, I'm deleting it.

And let's look at how usually again, a very naïve definition of a service will look like. So, I have the same configuration of the application. But with CPU and memory limits, I'm using a deployment object, which is a bit more powerful than a pod, because it's basically create a number of pods. For example, in this case, it's like two pods. It's also like, if one of them is going down, it's going to revive them. It's also designed for a rollout strategy. Basically, deployment is the way we usually define an application.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Levelling up Monorepos with npm Workspaces
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Levelling up Monorepos with npm Workspaces
Top Content
Learn more about how to leverage the default features of npm workspaces to help you manage your monorepo project while also checking out some of the new npm cli features.
Automating All the Code & Testing Things with GitHub Actions
React Advanced Conference 2021React Advanced Conference 2021
19 min
Automating All the Code & Testing Things with GitHub Actions
Top Content
Code tasks like linting and testing are critical pieces of a developer’s workflow that help keep us sane like preventing syntax or style issues and hardening our core business logic. We’ll talk about how we can use GitHub Actions to automate these tasks and help keep our projects running smoothly.
Fine-tuning DevOps for People over Perfection
DevOps.js Conf 2022DevOps.js Conf 2022
33 min
Fine-tuning DevOps for People over Perfection
Top Content
Demand for DevOps has increased in recent years as more organizations adopt cloud native technologies. Complexity has also increased and a "zero to hero" mentality leaves many people chasing perfection and FOMO. This session focusses instead on why maybe we shouldn't adopt a technology practice and how sometimes teams can achieve the same results prioritizing people over ops automation & controls. Let's look at amounts of and fine-tuning everything as code, pull requests, DevSecOps, Monitoring and more to prioritize developer well-being over optimization perfection. It can be a valid decision to deploy less and sleep better. And finally we'll examine how manual practice and discipline can be the key to superb products and experiences.
Why is CI so Damn Slow?
DevOps.js Conf 2022DevOps.js Conf 2022
27 min
Why is CI so Damn Slow?
We've all asked ourselves this while waiting an eternity for our CI job to finish. Slow CI not only wrecks developer productivity breaking our focus, it costs money in cloud computing fees, and wastes enormous amounts of electricity. Let’s take a dive into why this is the case and how we can solve it with better, faster tools.
The Zen of Yarn
DevOps.js Conf 2022DevOps.js Conf 2022
31 min
The Zen of Yarn
In the past years Yarn took a spot as one of the most common tools used to develop JavaScript projects, in no small part thanks to an opinionated set of guiding principles. But what are they? How do they apply to Yarn in practice? And just as important: how do they benefit you and your projects?
In this talk we won't dive into benchmarks or feature sets: instead, you'll learn how we approach Yarn’s development, how we explore new paths, how we keep our codebase healthy, and generally why we think Yarn will remain firmly set in our ecosystem for the years to come.
Node.js Compatibility in Deno
Node Congress 2022Node Congress 2022
34 min
Node.js Compatibility in Deno
Can Deno run apps and libraries authored for Node.js? What are the tradeoffs? How does it work? What’s next?

Workshops on related topic

Building a Hyper Fast Web Server with Deno
JSNation Live 2021JSNation Live 2021
156 min
Building a Hyper Fast Web Server with Deno
WorkshopFree
Matt Landers
Will Johnston
2 authors
Deno 1.9 introduced a new web server API that takes advantage of Hyper, a fast and correct HTTP implementation for Rust. Using this API instead of the std/http implementation increases performance and provides support for HTTP2. In this workshop, learn how to create a web server utilizing Hyper under the hood and boost the performance for your web apps.
Deploying React Native Apps in the Cloud
React Summit 2023React Summit 2023
88 min
Deploying React Native Apps in the Cloud
WorkshopFree
Cecelia Martinez
Cecelia Martinez
Deploying React Native apps manually on a local machine can be complex. The differences between Android and iOS require developers to use specific tools and processes for each platform, including hardware requirements for iOS. Manual deployments also make it difficult to manage signing credentials, environment configurations, track releases, and to collaborate as a team.
Appflow is the cloud mobile DevOps platform built by Ionic. Using a service like Appflow to build React Native apps not only provides access to powerful computing resources, it can simplify the deployment process by providing a centralized environment for managing and distributing your app to multiple platforms. This can save time and resources, enable collaboration, as well as improve the overall reliability and scalability of an app.
In this workshop, you’ll deploy a React Native application for delivery to Android and iOS test devices using Appflow. You’ll also learn the steps for publishing to Google Play and Apple App Stores. No previous experience with deploying native applications is required, and you’ll come away with a deeper understanding of the mobile deployment process and best practices for how to use a cloud mobile DevOps platform to ship quickly at scale.
MERN Stack Application Deployment in Kubernetes
DevOps.js Conf 2022DevOps.js Conf 2022
152 min
MERN Stack Application Deployment in Kubernetes
Workshop
Joel Lord
Joel Lord
Deploying and managing JavaScript applications in Kubernetes can get tricky. Especially when a database also has to be part of the deployment. MongoDB Atlas has made developers' lives much easier, however, how do you take a SaaS product and integrate it with your existing Kubernetes cluster? This is where the MongoDB Atlas Operator comes into play. In this workshop, the attendees will learn about how to create a MERN (MongoDB, Express, React, Node.js) application locally, and how to deploy everything into a Kubernetes cluster with the Atlas Operator.
Azure Static Web Apps (SWA) with Azure DevOps
DevOps.js Conf 2022DevOps.js Conf 2022
13 min
Azure Static Web Apps (SWA) with Azure DevOps
WorkshopFree
Juarez Barbosa Junior
Juarez Barbosa Junior
Azure Static Web Apps were launched earlier in 2021, and out of the box, they could integrate your existing repository and deploy your Static Web App from Azure DevOps. This workshop demonstrates how to publish an Azure Static Web App with Azure DevOps.
How to develop, build, and deploy Node.js microservices with Pulumi and Azure DevOps
DevOps.js Conf 2022DevOps.js Conf 2022
163 min
How to develop, build, and deploy Node.js microservices with Pulumi and Azure DevOps
Workshop
Alex Korzhikov
Andrew Reddikh
2 authors
The workshop gives a practical perspective of key principles needed to develop, build, and maintain a set of microservices in the Node.js stack. It covers specifics of creating isolated TypeScript services using the monorepo approach with lerna and yarn workspaces. The workshop includes an overview and a live exercise to create cloud environment with Pulumi framework and Azure services. The sessions fits the best developers who want to learn and practice build and deploy techniques using Azure stack and Pulumi for Node.js.