Thumbnail for null by null

12m 34s1,903 words~10 min read
YouTube auto captions
Transcript source

YouTube auto captions

This transcript was extracted from YouTube's auto-generated caption track. The transcript below is server-rendered so it can be read, searched, cited, and shared without opening the original YouTube player.

Pull quotes
[0:00]I'm a developer for Google and it's my great pleasure to welcome you here today to the Google developer Group Cloud.
[0:00]His name is Alex and he's going to be talking about building cloud native applications and how to test them.
[0:00]My name is Alex and I'm a developer advocate for Google Cloud and in this session I want to talk to you about how to build and test cloud native applications.
[0:00]And prior to this role, I was a software engineer working on Google Cloud networking team.
Use this transcript
Related transcript hubs

[0:00]Hello, welcome to the Google developer group Cloud. My name is Matt. I'm a developer for Google and it's my great pleasure to welcome you here today to the Google developer Group Cloud. Today we've got a great speaker, uh, from Google as well. His name is Alex and he's going to be talking about building cloud native applications and how to test them. Uh, I hope you have a great time and uh, let's welcome Alex. Hello everybody. My name is Alex and I'm a developer advocate for Google Cloud and in this session I want to talk to you about how to build and test cloud native applications. Before we dive into details, let me briefly introduce myself. I'm Alex, I'm a developer advocate. And prior to this role, I was a software engineer working on Google Cloud networking team. So I've been with Google for more than six years now and I had a chance to work with a lot of different customers and help them build solutions on Google Cloud. And I've seen a lot of different architectures, a lot of different applications, and what works and what doesn't. Uh, if you'd like to connect with me, feel free to do so on Twitter. Uh, my Twitter handle is A, B, O, L, G. Uh, feel free to reach out if you have any questions after this session, or if you just want to connect with me. So with that, uh, let's take a look at the agenda for today. First, I want to briefly define what cloud native means, and then we'll talk about best practices for building cloud native applications. And then we'll switch gears and we'll talk about how to test cloud native applications, what kind of testing strategies you can use, and then we'll do a quick demo. So what is cloud native? There are many different definitions of cloud native out there and, uh, if you search on Google, you'll find a lot of different articles, a lot of different, uh, opinions about what cloud native is. Uh, but for the purpose of this session, I want to use the definition from the Cloud Native Computing Foundation, or C N C F. So C N C F defines cloud native as, uh, open source software stack that is used to build and run scalable applications in modern, dynamic environments such as public clouds, private clouds, and hybrid clouds. And this is a very broad definition and I want to simplify it a little bit. So for me, cloud native means building applications that are designed to run on cloud infrastructure. And that means taking advantage of the cloud platform capabilities, such as scalability, reliability, and cost effectiveness. So what are the key characteristics of cloud native applications? First, uh, cloud native applications are typically built using microservices architecture. So instead of building a large monolithic application, you break it down into smaller, independent services that communicate with each other over the network. Second, cloud native applications are deployed in containers. So you package your application and all its dependencies into a container image, and then you deploy that image to a container orchestration platform like Kubernetes. Third, cloud native applications are designed to be observable. So you collect metrics, logs, and traces from your application and you use them to monitor its health and performance. And finally, cloud native applications are automated. So you automate the deployment, scaling, and management of your application using tools like C I C D pipelines and infrastructure as code. So that's a brief overview of what cloud native means. Now let's talk about best practices for building cloud native applications. First, uh, you should design your application for failure. So assume that any part of your application can fail at any time and design your application to be resilient to those failures. For example, you can use techniques like retries, circuit breakers, and bulkheads to make your application more resilient. Second, uh, you should embrace immutability. So instead of updating existing instances of your application, you should create new instances and replace the old ones. This makes your application more consistent and easier to manage. Third, uh, you should automate everything. So automate the deployment, scaling, and management of your application using tools like C I C D pipelines and infrastructure as code. And finally, uh, you should monitor everything. So collect metrics, logs, and traces from your application and use them to monitor its health and performance. So that's a brief overview of best practices for building cloud native applications. Now let's switch gears and let's talk about how to test cloud native applications. So why is testing cloud native applications different from testing traditional applications? The main reason is that cloud native applications are distributed. So they consist of multiple independent services that communicate with each other over the network. And this makes testing more challenging because you need to test the interactions between these services, not just the individual services themselves. So what kind of testing strategies can you use for cloud native applications? First, uh, you should use unit tests to test individual components of your application in isolation. So unit tests are fast and they're easy to write, and they help you catch bugs early in the development cycle. Second, uh, you should use integration tests to test the interactions between different components of your application. So integration tests are more complex than unit tests, but they help you catch bugs that unit tests might miss. Third, uh, you should use end-to-end tests to test your entire application from end to end. So end-to-end tests simulate real user scenarios and they help you verify that your application works as expected. And finally, uh, you should use chaos engineering to test the resilience of your application. So chaos engineering involves injecting failures into your application and observing how it behaves. This helps you identify weaknesses in your application and make it more resilient to failures. So that's a brief overview of testing strategies for cloud native applications. Now let's do a quick demo. In this demo, I'm going to show you how to build and test a simple cloud native application using Google Cloud. So let's switch to my screen. Here I have a simple Go application that exposes a single H T T P endpoint. And this endpoint returns a simple message, Hello Cloud Native. And I also have a simple Docker file that builds a Docker image for this application. And I have a simple Kubernetes deployment file that deploys this application to Kubernetes. So let's go ahead and deploy this application to Kubernetes. I'm going to use Google Kubernetes Engine, or G K E, to deploy this application. So first, I need to create a G K E cluster. I'm going to use the G Cloud command line tool to create a new cluster. This will take a few minutes, so I'm going to fast forward the video. Now that the cluster is created, I can deploy the application to Kubernetes. I'm going to use the Cube C T L command line tool to deploy the application. This will deploy the application to Kubernetes and create a new service that exposes the application to the internet. Now that the application is deployed, I can access it using the external I P address of the service. I can get the external I P address using the Cube C T L get service command. Now I can open this I P address in my browser and I should see the Hello Cloud Native message. And indeed, I see Hello Cloud Native. So the application is deployed and it's working as expected. Now let's talk about how to test this application. First, uh, I'm going to write a simple unit test for the Go application. I'm going to use the Go testing framework to write a simple test that verifies that the H T T P endpoint returns the correct message. So here I have a simple Go test file that tests the H T T P endpoint. And this test creates a new H T T P request to the endpoint and verifies that the response body contains the Hello Cloud Native message. Let's go ahead and run this test. I can run the test using the Go test command. And the test passed. So the unit test is working as expected. Next, uh, I'm going to write a simple integration test for the application. So this integration test will deploy the application to a local Kubernetes cluster and then it will send an H T T P request to the application and verify that it returns the correct message. I'm going to use kind to create a local Kubernetes cluster. So here I have a simple shell script that creates a kind cluster and then it deploys the application to the cluster. And then it waits for the application to be ready. And then it sends an H T T P request to the application and verifies that it returns the correct message. Let's go ahead and run this integration test. I can run the test using the shell script. This will take a few minutes, so I'm going to fast forward the video. Now that the integration test is complete, I can see that all the tests passed. So the integration test is working as expected. Finally, uh, I'm going to write a simple end-to-end test for the application. So this end-to-end test will use Selenium to open a web browser and navigate to the application and verify that it displays the correct message. I'm going to use a simple Python script to write the end-to-end test. So here I have a simple Python script that uses Selenium to open a web browser and navigate to the application. And then it verifies that the page contains the Hello Cloud Native message. Let's go ahead and run this end-to-end test. I can run the test using the Python script. And the test passed. So the end-to-end test is working as expected. So that's a brief demo of how to build and test a simple cloud native application using Google Cloud. To summarize, in this session we talked about what cloud native means, best practices for building cloud native applications, and how to test cloud native applications. I hope you found this session useful. If you have any questions, feel free to reach out to me on Twitter, or you can find me on Google Cloud community Slack channel. Thank you. Alright, thank you very much, Alex, for that wonderful presentation. Um, I learned a lot myself and I hope you did too. Um, if you want to find out more about the Google Developer Group Cloud, please, uh, look up our Meetup page. Um, we have a lot of different events, uh, coming up in the future. Um, we've got one, uh, coming up in a couple of weeks on, uh, serverless, um, technologies. So look out for that one. We'll be announcing that shortly. And, uh, if you have any feedback or if you have any suggestions for topics, please let us know. We'd love to hear from you. Um, yeah. Thank you very much for joining us today. And, uh, hopefully we'll see you at the next event. Thanks. Bye.

Need another transcript?

Paste any YouTube URL to get a clean transcript in seconds.

Get a Transcript