Skip to content

Hello-World, written in Python, served by Flask, integrated with GitHub Actions, Packaged by Helm, orchestrated by Kubernetes and Delivered with FluxCD

License

Notifications You must be signed in to change notification settings

keivanipchihagh/hello-k8s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello-k8s

Simple Hello-World single-page site, written in Python, served by Flask, integrated with GitHub Actions, Packaged by Helm, orchestrated by Kubernetes and Delivered with FluxCD. Oh wait, that's the an entire CI/CD! 🚀

Table of Contents
  1. What is a CI/CD?
  2. Installation
  3. Components
  4. Usage
  5. Contributing
  6. License

What is a CI/CD?

CI and CD stand for continuous integration and continuous delivery/continuous deployment. In other words, CI is a modern software development practice in which incremental code changes are made frequently and reliably.

Installation

Install Kubernetes

You can follow the official documentation to install a Kubernetes Cluster on production environment. In case you believe the documentation is written in japanese, follow this tutorial.

Install Helm

To install Helm3, run the script below which will automatically connect to your Kubernetes cluster:

curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Install flux

Installing FluxCD is as easy as running the below script:

curl -s https://fluxcd.io/install.sh | sudo bash

However, to bootstamp FluxCD to your repository, follow these instructions.

Components

Python

Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured, object-oriented and functional programming (wikipedia).

Flask

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions (wikipedia).

GitHub Actions

GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub. Make code reviews, branch management, and issue triaging work the way you want (github).

Kubernetes

Kubernetes is an open-source container orchestration system for automating software deployment, scaling, and management. Originally designed by Google, the project is now maintained by the Cloud Native Computing Foundation. The name Kubernetes originates from Ancient Greek, meaning 'helmsman' or 'pilot' (wikipedia).

Helm

Helm is a tool that automates the creation, packaging, configuration, and deployment of Kubernetes applications by combining your configuration files into a single reusable package. In a microservice architecture, you create more microservices as the application grows, making it increasingly difficult to manage (circleci).

FluxCD

FluxCD is a Continuous Delivery tool to help keep Kubernetes clusters in sync with configuration sources such as Git repositories and automate configuration updates when available. Flux is built with the GitOps toolkit and supports multi-tenancy and syncing an arbitrary number of Git repositories (internaldeveloperplatform).

Usage

You need the following files under your FluxCD bootstrap repository:

namespace.yaml:

apiVersion: v1
kind: Namespace
metadata:
    name: hello-k8s

source.yaml:

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
  name: hello-k8s
  namespace: hello-k8s
spec:
  interval: 5m
  url: https://github.com/keivanipchihagh/hello-k8s
  ref:
    branch: main
  ignore: |-
    # exclude all
    /*
    # include charts directory
    !/charts/

release.yaml:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: hello-k8s
  namespace: hello-k8s
spec:
  interval: 1m
  releaseName: hello-k8s
  chart:
    spec:
      chart: charts
      sourceRef:
        kind: GitRepository
        name: hello-k8s
  install:
    createNamespace: true

kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - namespace.yaml
  - source.yaml
  - release.yaml

Contributing

Contributions are warmly welcomed. In case you have a suggestion, please fork the repo and create a pull request. You can also simply open an issue with the relevant tags.

⭐ Also, don't forget to give the project a star!

License

Distributed under the MIT License. See LICENSE for more information.

About

Hello-World, written in Python, served by Flask, integrated with GitHub Actions, Packaged by Helm, orchestrated by Kubernetes and Delivered with FluxCD

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published