GithubHelp home page GithubHelp logo

galexrt / presentation-gitlab-k8s Goto Github PK

View Code? Open in Web Editor NEW
165.0 11.0 133.0 10.23 MB

These are the example files for my presentation and blog post about GitLab + Kubernetes for Continuous Delivery.

Home Page: https://edenmal.moe/post/2019/GitLab-Kubernetes-Using-GitLab-CIs-Kubernetes-Cluster-feature/

License: MIT License

Go 48.44% Makefile 8.85% Dockerfile 1.48% Smarty 41.23%

presentation-gitlab-k8s's Introduction

presentation-gitlab-k8s

These are the example files for my presentation about GitLab + Kubernetes for Continuous Integration and Delivery. They are also partly used in my GitLab CI posts.

Kubernetes and GitLab

INFO This is one of the ways to deploy an application as a Docker image to your K8s cluster. It is important to note that this repository is just an example of what can be done.

The presentation can be found here: Kubernetes - WYNTK - GitLab CI + Kubernetes Presentation. The blog post these files are specifically used in is here: GitLab + Kubernetes: Using GitLab CI's Kubernetes Cluster feature and old post GitLab + Kubernetes: Perfect Match for Continuous Delivery with Container.

An uptodate list of all my blog posts around GitLab and Kubernetes can be found on this page. This list is just an excerpt of some of my GitLab posts:

Table of Contents

Features

This repository shows off/uses the following GitLab CI features:

Other features also shown are:

Requirements

The following points are required for this repository to work correctly:

Using this repository

NOTE

Best is to follow the blog post GitLab + Kubernetes: Using GitLab CI's Kubernetes Cluster feature as it contains more detailed instructions about using GitLab CI for Kubernetes.

You have to replace the following addresses in all files:

  • gitlab.zerbytes.net with your GitLab address (e.g. gitlab.example.com).
  • edenmal.net (in the Ingress manifest) with your domain name.
    • You probably also want to change the subdomain name while you are at it.
  • presentation-gitlab-k8s with the Namespace name of your choice.

If you are using prometheus-operator/prometheus-operator, then you also need to replace zerbytes-live-proj-monitoring with the Namespace your Prometheus instance is running in, in this file /gitlab-ci/monitoring/service-monitor.yaml. You then also want to kubectl create/apply the file to your Kubernetes cluster during creation/apply process for the manifests in gitlab-ci/.

You also need to create a "Docker Login" Secret which contains your GitLab Registry access data (e.g. Username and Access token with registry access) named whatever your want in the Namespace presentation-gitlab-k8s. A guide for that can be found here: Kubernetes.io - Pull an Image from a Private Registry. Instead of using the imagePullSecrets, we'll be using the default ServiceAccount in the Namespace to automatically use the created Docker login Secret, see Kubernetes - Configure Service Accounts for Pods - Add ImagePullSecrets to a service account.

The Namespace manifest is in the gitlab-ci/ directory.

Then you can just import the repository into your GitLab instance and are ready to go.

For information on how to use these files and setup GitLab Kubernetes cluster/integration, see the above blog post and in specific this post GitLab + Kubernetes: Perfect Match for Continuous Delivery with Container.

GitLab Docs References

As of GitLab 10.3 the Kubernetes Integration is marked as deprecated and with 10.4 it is now disabled, the following docs show the new feature called Clusters:

File Structure

Example Application

Kubernetes Base GitLab CI Manifests

  • gitlab-ci/
    • monitoring/
      • service-monitor.yaml - Contains a prometheus-operator/prometheus-operator ServiceMonitor manifest to automatically monitor the application(s).
    • namespace.yaml - Namespace in which the GitLab CI will deploy the application.
    • rbac.yaml - Contains GitLab CI RBAC Role, RoleBinding and ServiceAccount.
    • secret.yaml - Contains a TLS wildcard certificate for the application Ingress.

Build Process

Deployment Manifests

Miscellaneous

Thanks!

Thanks to @shadycuz - GitHub for his comments with improvements for the code in this repository!

License

The files in this repo can be used under the MIT license, see LICENSE file.

presentation-gitlab-k8s's People

Contributors

galexrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

presentation-gitlab-k8s's Issues

Rework to use Helm Chart

Tasks:

  • Use Helm Chart
  • Update GitLab CI yaml accordingly
  • Update readme files + docs + versions
  • Update / Write new blog post

"This isn't the best way"

Thanks for making this available. In the README it says:

INFO This isn't the best way to deploy application Docker images to K8s, this is more of an example how simple it can be.

Is there a discussion somewhere on the limitations of the approach taken? Why isn't it the best?

Build Stage

In the project, the construction part is done directly from the gitlab-cy file with the goland image. But another way to do it is to handle this build in a dockerfile (eg a multistage).

I like the idea that everything is in a Docker and being able to build in any environment with the same version of goland. At the same time, for example if the application is python or dotnet, the way it is current in the project should remember to change the python versions in both the Dockerfile and gitlab-ci file. What I don't like is that you end up handling everything with Docker-in-Docker.

What do you consider to be a best practice and why?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.