These are the example files for my presentation and blog post about GitLab + Kubernetes for Continuous Delivery.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 70edd41 Oct 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gitlab-ci Merge branch 'license' Oct 4, 2018
manifests Merge branch 'license' Oct 4, 2018
media Made the image smaller Feb 24, 2018
vendor
.gitingore Added Gopkg.* files to README file structure section Jun 15, 2018
.gitlab-ci.yml Added prometheus-operator ServiceMonitor Jun 26, 2018
CODE_OF_CONDUCT.md Added CODE_OF_CONDUCT.md Aug 24, 2017
Dockerfile Added Todo to README.md May 30, 2018
Gopkg.lock Updated README.md Feb 24, 2018
Gopkg.toml Improved the GitLab CI dev and live stage Jan 17, 2018
LICENSE Added MIT LICENSE Oct 4, 2018
Makefile
README.md Merge branch 'license' Oct 4, 2018
VERSION Updated v1.0.1 Jun 26, 2018
main.go Merge branch 'license' Oct 4, 2018

README.md

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 isn't the best way to deploy application Docker images to K8s, this is more of an example how simple it can be.

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: 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

You have to replace the following addresses in all files:

  • gitlab.zerbytes.net with your GitLab address (e.g. gitlab.example.com).
  • registry.zerbytes.net with your Docker registry address (e.g. registry.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 coreos/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 regsecret in the Namespace presentation-gitlab-k8s. A guide for that can be found here: Kubernetes.io - Pull an Image from a Private Registry. 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 coreos/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.