PostgreSQL internally converts all column and table names to lowercase when executing the SQL query.
If the column or table name contains uppercase letters, we need to use double quotes to be able to reference them.
When we get the error message
ERROR: column “username” does not exist
select * from public.”AspNetUsers” where UserName = ‘… ^
HINT: Perhaps you meant to reference the column “AspNetUsers.UserName”. SQL state: 42703
The first line of the error message shows, that PostgreSQL internally converted UserName to username. To be able to reference the column, use double-quotes. If you reference the table name too, don’t copy the hint, make sure the table and column names are separate strings in double-quotes with a period between them.
select * from public."AspNetUsers" where "AspNetUsers"."UserName" = 'MY_VALUE';
Docker images are stored on the host to launch as fast as possible. The drawback is, Docker can fill the hard drive with unused images. A recent possible bug in Docker caused the accumulation of unused, unreferenced images on the host. To delete all Docker containers and images, use these commands in the terminal
Get the base line
# Get the free disk space
df -h
# List the running containers
docker ps
# List all containers
docker ps -a
# List the Docker images
docker images
In this exercise we will use Traefik, another popular proxy server. Traefik is widely used for multiple reasons: it is easier to configure, can automatically generate and renew SSL certificates using Let’s Encrypt. We will also use most of the scripts from the prior exercise.
Create the Traefik Role Based Access Control with ClusterRoleBinding. This will allow Traefik to serve all namespaces of the cluster. To restrict the Traefik to one namespace only, use the “namespace-specific RoleBindings”.
Deploy Traefik with a deployment. This introduces a few more network hops, but follows the Kubernetes best practices guidelines and provides more flexibility.
Large organizations need to control the incoming traffic to the Kubernetes cluster. The most secure way is to use an ingress controller and create an ingress to channel all incoming traffic to the cluster.
In Learn Kubernetes part 1 – Web application in a Kubernetes cluster we have created a simple web application pod and exposed it to the outside world with a service using a load balancer. We will use the files we have created in that exercise with one change. The deployment is the same:
In this exercise we will expose the service via an NGINX ingress controller. Delete type: LoadBalancer in the app1-frontend-service.yaml file, so Kubernetes will use type: ClusterIP, the default value.
To start the kubernetes/ingress-nginx ingress controller in any operating system, execute this command to create the ‘nginx-ingress-controller’ deployment with containers
To launch the application and configure the resources to expose it outside of the Kubernetes cluster, open a terminal in the directory where you saved the files and execute
kubectl apply -f .
Verify the ingress
List the ingresses
kubectl get ingress
NAME HOSTS ADDRESS PORTS AGE
ingress * localhost 80 59s
This is the official Kubernetes dashboard, and for security reasons currently it is not recommended to use, but we can still use it in our local cluster to inspect the resources.