Solution Approach for Uploading Large Files Error in nginx + ingress + gunicorn Environment

In a Python Web application deployed on Kubernetes and running with Gunicorn, a series of errors occurred when uploading large files. Here, I document the solution approach. File Upload Process File upload flow: The uploaded file first reaches the host machine where Kubernetes is running. Nginx on the host machine forwards it via Proxy to the Ingress Controller in the Kubernetes cluster, which is also implemented using Nginx. Nginx in the Ingress Controller forwards it via Proxy to Gunicorn. Gunicorn starts several Workers to handle requests, so it forwards the request to a Worker. The Worker is the final Python Web App. Solving Error 413 The first encountered error was 413 Request Entity Too Large. During the upload process, the connection was interrupted (almost always at the same upload percentage), and the request returned 413. Initially, I considered the possibility of Nginx having a request body size limit. Checking the Nginx documentation, I found that the client_max_body_size parameter controls the request body size, with a default setting of 1mb. ...

February 28, 2019 · 4 min · Zhiya

Troubleshooting DNS Resolution Issues When Setting Up a Kubernetes Cluster

Problem Description While setting up a Kubernetes cluster and installing the kube-dns plugin, I ran an Ubuntu container and found that it couldn’t resolve domain names outside the cluster. Initially, it could resolve domain names within the cluster, but after some time, it couldn’t even resolve those. $ nslookup kubernetes.default Server: 10.99.0.2 Address 1: 10.99.0.2 kube-dns.kube-system.svc.cluster.local nslookup: can't resolve 'kubernetes.default' Troubleshooting Process Before troubleshooting, let’s consider the DNS resolution process in a Kubernetes cluster. In a cluster with kube-dns installed, the dnsPolicy attribute of a regular Pod is set to the default value ClusterFirst, meaning it points to the internal DNS server of the cluster. Kube-dns is responsible for resolving internal domain names, and the dnsPolicy value of the kube-dns Pod is Default, meaning it inherits the DNS server from the Node it resides on. For unresolved external domain names, kube-dns queries the external DNS server, as illustrated in the diagram. ...

July 15, 2018 · 5 min · Zhiya

Installing KVM Virtual Machine on Ubuntu 18.04 LTS

Recently, I installed KVM on the latest Ubuntu 18.04 to virtualize a small VM cluster. Here, I document the main process and some issues encountered. Preparation First, you need to check if the CPU supports virtualization. Run the following command to check if there are any virtualization-related terms in the /proc/cpuinfo file. If present, it indicates that the CPU supports virtualization technology. egrep -c '(svm|vmx)' /proc/cpuinfo If the command returns 0, it means the CPU does not support virtualization technology. Additionally, virtualization technology in the motherboard BIOS might not be enabled by default. If not, you need to enable it manually. ...

June 28, 2018 · 4 min · Zhiya