gitlab-ci-k8s-demo icon indicating copy to clipboard operation
gitlab-ci-k8s-demo copied to clipboard

GitLab CI + Kubernetes for CI/CD.

gitlab-ci-k8s-demo

Kubernetes and GitLab

Gitlab CI + Kubernetes 关于 CI/CD 的一个示例。在博客中有几篇文章专门来介绍关于 Gitlab CI 的:

Table of Contents

  • Requirements
  • Features
  • GitLab Docs References
  • File Structure
    • Example Application
    • Build Process
    • Deployment Manifests
    • Miscellaneous
  • Thanks!

Features

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

Other features also shown are:

  • coreos/prometheus-operator ServiceMonitor - for automatic monitoring of deployed applications.

Requirements

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

GitLab Docs References

  • GitLab Kubernetes Integration Docs: https://docs.gitlab.com/ce/user/project/integrations/kubernetes.html
  • GitLab Kubernetes Integration Docs Environment variables: https://docs.gitlab.com/ce/user/project/integrations/kubernetes.html#deployment-variables

File Structure

Example Application

  • main.go - The Golang example application code.
  • vendor/ - Contains the Golang example application dependencies (dep is used).
  • Gopkg.lock and Gopkg.toml - Golang dep .

Build Process

  • Dockerfile - Contains the Docker image build instructions.
  • .gitlab-ci.yml - Contains the GitLab CI instructions.

Deployment Manifests

  • manifests/ - Kubernetes manifests used to deploy the Docker image built in the CI pipeline.
    • deployment.yaml - Deployment for the Docker image.
    • ingress.yaml - Ingress for the application.
    • service.yaml - Service for the application.

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.