So maybe you are like me and ended up here because you want to know a thing or 2 about K8S (kubernetes)
As you can see in my first post on the topic of Kubernetes https://blog.roelsieg.nl/posts/101_k8s/ I did already learn myself howto install minikube which we will use here also, but I have no clue on what I am doing yet. So basicaly I called in the cavelary and asked some support from a friend https://nl.linkedin.com/in/dcabooter
He explained me how to setup a deployment of a few nodes in kubernetes on a minikube cluster.
The files I use and refrence in this blog can also be found here on my github We will be installing a few ngnix pods a pod to handle the PHP calls with FPM and and ingress to enable incoming traffic to your pobs
Deployment of NGNIX PODS
First we start with the deployment of the ngnix pods: (see also ngnix_deploy.yml ) We also defined the service to run in the same file. Some explanations:
# By using the "app: nginx" we link both the service and the pod
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
...
..
kind: Service
apiVersion: v1
metadata:
name: nginx-service
spec:
selector:
app: nginx
# We use a default image from I believe dockerhub
containers:
- name: nginx
image: nginx:latest
# We claim a persistent volume
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
# We place a ngnix config file
- name: nginx-config
configMap:
name: nginx-config
items:
- key: nginx.conf
path: site.conf
# The service type is a loadbalancer goint to port 80 on the pods
spec:
selector:
app: nginx
ports:
- port: 80 # Default port for image
type: LoadBalancer
Although the Kubernetes deployment and service definitions are usualy not preceded by the normal “—” at the start of a YAML file. These are just YAML definition files.
The task of using the persistent volume consists of a 2 step aproach :
- Create the persistent volume pv.yml
- Create a claim on this vloume to use pv_claim.yml
Futher we want to define our own ngnix site.conf we also uploaded ngnix_config.yml
TO BE CONTINUED WITH “php-fpm-deployment”