Docker Debug

May 16th, 2020
k8s

Not Fun

Last weekend, I picked up a course on microservices in the world of React and Node. I stated that I would alternate days studying this course and the MySQL course I was working on, but that didn't actually happen. I became so enamored with this course, it's been all I've been working on during my study time the entire week. Given that it's a 45 hour course, it's going to take a while to finish, but when I do, I'll come back to the MySQL course. There's just so much interesting stuff in this microservices course, I can't get enough. However, even for a 45 hour course, it seems like Stephen Grider is packing a lot of information in. We are covering a huge breadth of technologies, and it's hard to keep up sometimes. It seems like Kubernetes and Docker are very hot in the tech world right now, and rightfully so. These technologies have been around for a few years now, but they are fast becoming widely used tools in many companies' tool belts. However, adoption of these tools seems to be slow-going, and I think the reason for this is that these tools are very difficult to wrap your head around. I'm struggling with it, but I think I understand the process so far.

k8s

I was just about to wrap up the first section on Kubernetes last night, and everything was going pretty well. There are a lot of configuration files associated with this process, and I figured somewhere along the lines, something would get messed up. To my surprise, I hadn't run into any errors, up until last night. For each microservice in our application, we have a separate deployment configuration. If we make a change to any one of these services, we have to go through a somewhat tedious process to reflect the new changes. There's a tool called Skaffold which you can give it its own configuration file, and it will handle all of the deployments for you. All you have to do is run one command line, and it takes care of everything. It looked like I had everything set up correctly in the configuration file, so I went ahead and ran the line I needed for Skaffold to do its work. It did not work. I tried rebooting Docker and Kubernetes, still nothing.

k8s

I combed through the configuration file, and I thought I figured out what was going on. In my React app on the frontend, I had given my js files the extension of .jsx, which is fairly common in React applications. This just helps with development a little bit; vsCode has a better time with autocompletion when this extension is given, I have found. In the Skaffold configuration file, however, I was only looking for files that had the extension of .js. Instead of changing that in the config file, which I now think would have been a much easier fix, I changed the files themselves to .js extensions in the React application. I went to run Skaffold again, and it still didn't work. I thought maybe I had to do an initial build and apply of the image to get it back on track, but once I did, I noticed in the log of the Skaffold build that the client Docker image was being given a tag of dirty instead of latest. I googled this to see what answers were out there, and found nothing. Unfortunately, unline JavaScript or React, my Google skills with Docker and Kubernetes are lacking, as I'm kind of feeling my way in the dark still. I looked at the different images I have on my computer, though, and noticed there was a latest version of client and a dirty image. I figured maybe it would be best just to prune all images and rebuild/push them. That's what I'm in the process of doing right now. This part has not been fun, and I feel like I'm wasting time, but maybe it's helping me learn a little to go through some deep debugging.

Until tomorrow!

Created by Sam Thoyre, © 2019