SlideShare a Scribd company logo
DE L'INTÉGRATION CONTINUE
AU DÉPLOIEMENT CONTINU
AVEC K8S & GITLAB CI
Les bords de l’Erdre à Nantes
Jean-Pierre Dalbéra
VINCENT LOMBARD
GIT.IO/JRES-GITLAB
CI/CD avec K8s & Gitlab CI 2
CI/CD avec K8s & Gitlab CI 3
1
CI/CD avec K8s & Gitlab CI 4
CI/CD avec K8s & Gitlab CI 5
FROM java:7-jre-alpine
ADD target/tomcat.jar /tomcat.jar
RUN apk update&&apk add ttf-dejavu
EXPOSE 8080
ENV KSUP_CONF_FOLDER /conf
CMD ["sh", "-c", "java -jar tomcat.jar -Dconf.dir=$KSUP_CONF_FOLDER"]
2
CI/CD avec K8s & Gitlab CI 6
Kubernetes
CI/CD avec K8s & Gitlab CI 7
2
CI/CD avec K8s & Gitlab CI 8
Gitlab
CI/CD avec K8s & Gitlab CI 9
stages:
- build
- build_image
- deploy
maven_compile:
stage: build
image: v20100/maven:3.3.9
before_script:
- mvn --version
script:
- mvn -B -s settings.xml clean package
- mv target/*.jar target/tomcat.jar
artifacts:
paths:
- target/*.jar
only:
- master
maven_compile:
stage: build
image: v20100/maven:3.3.9
before_script:
- mvn --version
script:
- mvn -B -s settings.xml clean package
- mv target/*.jar target/tomcat.jar
artifacts:
paths:
- target/*.jar
only:
- master
- tags
- 2-configuration-ldap
- 6-migration-cluster-vers-nfs
tags:
- kubernetes
docker_build:
stage: build_image
image: gitlab/dind:latest
before_script:
- docker login -u $REGISTRY_LOGIN -p $REGISTRY_PASSWORD registry.…
script:
- docker info
- docker build -t $CONTAINER_TEST_IMAGE .
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_MASTER_IMAGE
- docker push $CONTAINER_TEST_IMAGE
- docker push $CONTAINER_MASTER_IMAGE
variables:
CONTAINER_TEST_IMAGE: registry.universite-lyon.fr/java/…
$CI_PROJECT_NAME:$CI_BUILD_REF
CONTAINER_MASTER_IMAGE: registry.universite-lyon.fr/java/…
$CI_PROJECT_NAME:latest
dependencies:
- maven_compile
k8s_deploy_preproduction:
stage: deploy
image: registry.universite-lyon.fr/kubectl/preprod
script:
- echo $KUBERNETES_PATCH
- /usr/local/bin/kubectl --insecure-skip-tls-verify --namespace ksup patch deployment…
ksup-deployment-nfs -p "$KUBERNETES_PATCH"
variables:
CONTAINER_TEST_IMAGE: registry.universite-lyon.fr/java/…
$CI_PROJECT_NAME:$CI_BUILD_REF
KUBERNETES_PATCH: …
"{"spec": {"template":{"metadata":{"labels":{"version":"$CI_BUILD_REF"}}}}}"
environment:
name: preproduction
url: https://ksup.universite-lyon.fr
dependencies:
- docker_build
only:
- master
CI/CD avec K8s & Gitlab CI 10
POUR ALLER PLUS LOIN
• Usage code & conf applicative
• https://git.io/jres-gitlab
Les bords de l’Erdre à Nantes
Jean-Pierre Dalbéra

More Related Content

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

CI/CD with K8s & Gitlab CI

  • 1. DE L'INTÉGRATION CONTINUE AU DÉPLOIEMENT CONTINU AVEC K8S & GITLAB CI Les bords de l’Erdre à Nantes Jean-Pierre Dalbéra VINCENT LOMBARD GIT.IO/JRES-GITLAB
  • 2. CI/CD avec K8s & Gitlab CI 2
  • 3. CI/CD avec K8s & Gitlab CI 3
  • 4. 1 CI/CD avec K8s & Gitlab CI 4
  • 5. CI/CD avec K8s & Gitlab CI 5 FROM java:7-jre-alpine ADD target/tomcat.jar /tomcat.jar RUN apk update&&apk add ttf-dejavu EXPOSE 8080 ENV KSUP_CONF_FOLDER /conf CMD ["sh", "-c", "java -jar tomcat.jar -Dconf.dir=$KSUP_CONF_FOLDER"]
  • 6. 2 CI/CD avec K8s & Gitlab CI 6 Kubernetes
  • 7. CI/CD avec K8s & Gitlab CI 7
  • 8. 2 CI/CD avec K8s & Gitlab CI 8 Gitlab
  • 9. CI/CD avec K8s & Gitlab CI 9
  • 10. stages: - build - build_image - deploy maven_compile: stage: build image: v20100/maven:3.3.9 before_script: - mvn --version script: - mvn -B -s settings.xml clean package - mv target/*.jar target/tomcat.jar artifacts: paths: - target/*.jar only: - master maven_compile: stage: build image: v20100/maven:3.3.9 before_script: - mvn --version script: - mvn -B -s settings.xml clean package - mv target/*.jar target/tomcat.jar artifacts: paths: - target/*.jar only: - master - tags - 2-configuration-ldap - 6-migration-cluster-vers-nfs tags: - kubernetes docker_build: stage: build_image image: gitlab/dind:latest before_script: - docker login -u $REGISTRY_LOGIN -p $REGISTRY_PASSWORD registry.… script: - docker info - docker build -t $CONTAINER_TEST_IMAGE . - docker tag $CONTAINER_TEST_IMAGE $CONTAINER_MASTER_IMAGE - docker push $CONTAINER_TEST_IMAGE - docker push $CONTAINER_MASTER_IMAGE variables: CONTAINER_TEST_IMAGE: registry.universite-lyon.fr/java/… $CI_PROJECT_NAME:$CI_BUILD_REF CONTAINER_MASTER_IMAGE: registry.universite-lyon.fr/java/… $CI_PROJECT_NAME:latest dependencies: - maven_compile k8s_deploy_preproduction: stage: deploy image: registry.universite-lyon.fr/kubectl/preprod script: - echo $KUBERNETES_PATCH - /usr/local/bin/kubectl --insecure-skip-tls-verify --namespace ksup patch deployment… ksup-deployment-nfs -p "$KUBERNETES_PATCH" variables: CONTAINER_TEST_IMAGE: registry.universite-lyon.fr/java/… $CI_PROJECT_NAME:$CI_BUILD_REF KUBERNETES_PATCH: … "{"spec": {"template":{"metadata":{"labels":{"version":"$CI_BUILD_REF"}}}}}" environment: name: preproduction url: https://ksup.universite-lyon.fr dependencies: - docker_build only: - master CI/CD avec K8s & Gitlab CI 10
  • 11. POUR ALLER PLUS LOIN • Usage code & conf applicative • https://git.io/jres-gitlab Les bords de l’Erdre à Nantes Jean-Pierre Dalbéra