Jenkins K8s-Installer
Jenkins K8s-Installer
Mohamed HAMMOUDA
DevOps
A Successful Path To
Continuous Integration
And Continuous Delivery
1 INTRODUCTION AU DEVOPS
2
▪ PLAN DE L’ATELIER
1 INTRODUCTION AU DEVOPS
3
▪ KUBERNETES
▪ K8s Installer tools
MiniKube
is usuallythe first Kubernetes technology Minimum requirements for the host machine:
found when someone wants to begin •CPU: 2
(Kubernetes official documentation offers a •Memory: 2 GB
tutorial to deploy your first cluster using •Disk space: 20 GB
miniKube).
PROS CONS
•Easy to install •Too minimal
•Light
The inconvenience of this solution is this is not possible to add other nodes, and
by consequence, to discover how the architecture really works and the full power
of Kubernetes.
▪ KUBERNETES
▪ K8s Installer tools
Kind
Kind is another tool to deploy a Kubernetes This solution allows you to deploy all type of clusters:
cluster locally. Its specificity is that the •Single node
cluster will be deployed inside a Docker •1 master and several workers
container. •Several masters and several workers
PROS CONS
•Very easy to install •Network external
•Cluster very easy to access to the cluster
deploy more complicated
The main inconvenience for a beginner is that as the cluster is deployed inside a
docker container, so the network management to get access to the cluster is
more difficult.
▪ KUBERNETES
▪ K8s Installer tools
Kubeadm
Kubeadm is the “hard way” to begin with solution is quite heavy to run on a laptop. Each node
Kubernetes. With this solution, you will be should be deployed in a VM and the minimal
able to bootstrap a minimum viable requirements are:
Kubernetes cluster that conforms to best •Memory: 2 GB
practices. The cluster minimal size is •CPU: 2 (only for the master)
composed of two nodes:
PROS CONS
•Full architecture •Installation more
production level challenging
•Use docker containers •Very heavy to run on a
single laptop
•Only one node master
authorized
The main inconvenience for a beginner is that as the cluster is deployed inside a
docker container, so the network management to get access to the cluster is
more difficult.
▪ KUBERNETES
▪ Minikube
MINIKUBE START
minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes.
CREATING A DEPLOYMENT
• deploy Nginx server to your Kubernetes cluster.
$ kubectl create deployment Nginx --image=nginx
deployment.apps/kubia created
The Deployment object is now stored in the Kubernetes API. The existence of this object tells
Kubernetes that the nginx container must run in your cluster.
You’ve stated your desired state. Kubernetes must now ensure that the actual state reflects
your wishes.
▪ KUBERNETES
▪ Minikube
LISTING DEPLOYMENTS
The interaction with Kubernetes consists mainly of
the creation and manipulation of objects via its API.
A service with the type LoadBalancer provisions an external load balancer, which makes the service accessible
via a public IP. This is the type of service you’ll create now.
The easiest way to create the service is to use the following imperative command:
• Create a loadBalancer Service
$ kubectl expose deployment nginx --type=LoadBalancer --port 8080
service/kubia exposed
$ minikube ip
192.168.49.2
$kubectl -n default edit svc nginx
externalIPs:
- 172.42.42.100
$kubectl -n default get service nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx LoadBalancer 10.96.63.171 192.168.49.2 80:30497/TCP 7d
▪ KUBERNETES
▪ Minikube
LISTING SERVICES
Services are API objects, just like Pods,
Deployments, Nodes and virtually everything else
in Kubernetes, so you can list them by executing
kubectl get services, as in the next listing. The list shows two services with their types, IPs and the
ports they expose. The kubia service doesn’t yet have an
external IP address. Whether it gets one depends on how
Tester le scenario suivant :
you’ve deployed the cluster.
• Supprimer un pod
$ kubectl delete pod « name »