Setting up Docker, Kubernetes and AWS
December 16, 2023
devopsThe first task I have undertaken is to update my Ansible repo to install the Docker and Kubernetes software I will need for this adventure.
I have used Docker quite a bit in the past and it allows one to create a Dockerfile which is a set of instructions to build an image which should work in any docker environment. I come from a PHP / Laravel background, so I think my first project will be to get a Kubernetes install to serve a Laravel app on AWS with a single node.
This is the corresponding github repo and is the dockerfile i will use as i follow this video series.
To get up and running with kubernetes, i decided to try minikube. I have added this to the ansible playbook but the first run of the minikube start
command compalined that there was no driver
then i used minikube start --driver=docker
which resulted in a permission error like so:
Exiting due to PROVIDER_DOCKER_NEWGRP: "docker version --format -:" exit status 1: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/version": dial unix /var/run/docker.sock: connect: permission denied
Suggestion: Add your user to the 'docker' group: 'sudo usermod -aG docker $USER && newgrp docker'
so i added the user, but this didnt fix the issue, but this did
chmod 666 /var/run/docker.sock
now i can set the default to docker with minikube config set driver docker
so now starting minikube produced:
😄 minikube v1.30.1 on Debian kali-rolling
✨ Using the docker driver based on user configuration
📌 Using Docker driver with root privileges
👍 Starting control plane node minikube in cluster minikube
🚜 Pulling base image ...
💾 Downloading Kubernetes v1.26.3 preload ...
> preloaded-images-k8s-v18-v1...: 397.02 MiB / 397.02 MiB 100.00% 4.14 Mi
> gcr.io/k8s-minikube/kicbase...: 373.53 MiB / 373.53 MiB 100.00% 3.09 Mi
🔥 Creating docker container (CPUs=2, Memory=2800MB) ...
🐳 Preparing Kubernetes v1.26.3 on Docker 23.0.2 ...
▪ Generating certificates and keys ...
▪ Booting up control plane ...
▪ Configuring RBAC rules ...
🔗 Configuring bridge CNI (Container Networking Interface) ...
🔎 Verifying Kubernetes components...
❗ Executing "docker container inspect minikube --format={{.State.Status}}" took an unusually long time: 18.517914147s
💡 Restarting the docker service may improve performance.
🌟 Enabled addons: storage-provisioner, default-storageclass
❗ /usr/bin/kubectl is version 1.28.2, which may have incompatibilities with Kubernetes 1.26.3.
▪ Want kubectl v1.26.3? Try 'minikube kubectl -- get pods -A'
🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
but minikube dashboard
didnt fancy it.
❗ Executing "docker container inspect minikube --format={{.State.Status}}" took an unusually long time: 2.222619049s
💡 Restarting the docker service may improve performance.
🔌 Enabling dashboard ...
▪ Using image docker.io/kubernetesui/dashboard:v2.7.0
▪ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
💡 Some dashboard features require the metrics-server addon. To enable all features please run:
minikube addons enable metrics-server
🤔 Verifying dashboard health ...
🚀 Launching proxy ...
🤔 Verifying proxy health ...
panic: send on closed channel
goroutine 107 [running]:
k8s.io/minikube/cmd/minikube/cmd.readByteWithTimeout.func2()
/app/cmd/minikube/cmd/dashboard.go:192 +0x67
created by k8s.io/minikube/cmd/minikube/cmd.readByteWithTimeout
/app/cmd/minikube/cmd/dashboard.go:187 +0x158
I think there was an issue with the ram, as i had so many browser windows searching for the answers, but shutting most of them down, allowed me to start the dashboard and i saw this
Which is a great start, I am now going to work out how to deploy a Dockerfile app! wish me luck
If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon