Giter Site home page Giter Site logo

teracy-dev-k8s's Introduction

teracy-dev-k8s

Setting up k8s cluster on teracy-dev (v0.6) with kubespray for a production ready local k8s cluster. This can be considered a local managed k8s service that we can use it for testing, it should work the same way as any k8s cluster on the cloud.

How to use

Configure workspace/teracy-dev-entry/config_default.yaml with the following similar content:

  • Use specific version:
teracy-dev:
  extensions:
    - _id: "entry-k8s" # this _id is used for overriding by the config_override.yaml file
      path:
        extension: teracy-dev-k8s
      location:
        git:
          remote:
            origin: https://github.com/teracyhq-incubator/teracy-dev-k8s.git
          branch: v0.3.0
      require_version: ">= 0.3.0"
      enabled: true
  • Use latest stable version (auto update):
teracy-dev:
  extensions:
    - _id: "entry-k8s" # this _id is used for overriding by the config_override.yaml file
      path:
        extension: teracy-dev-k8s
      location:
        git:
          remote:
            origin: https://github.com/teracyhq-incubator/teracy-dev-k8s.git
          branch: master
      require_version: ">= 0.3.0"
      enabled: true
  • Use latest develop version (auto update):
teracy-dev:
  extensions:
    - _id: "entry-k8s" # this _id is used for overriding by the config_override.yaml file
      path:
        extension: teracy-dev-k8s
      location:
        git:
          remote:
            origin: https://github.com/teracyhq-incubator/teracy-dev-k8s.git
          branch: develop
      require_version: ">= 0.4.0-SNAPSHOT"
      enabled: true

See this example setup: https://github.com/teracyhq-incubator/teracy-dev-entry-k8s#how-to-use

Vagrant Reload

Whenever the node(s) is reloaded, make sure to provision it so that the k8s cluster is working properly

$ vagrant halt
$ vagrant up --provision
$ vagrant reload --provision

Ansible Options

By default, we copy the sample inventory from kubespray into workspace/inventory if not exists yet, so you can configure ansible from the workspace/inventory directory.

Moreover, you can also override inventory options with teracy-dev-k8s['ansible']['host_vars'], see the configuration override section below

Accessing Kubernetes API

You should see the generated artifacts within the workspace/inventory/artifacts directory

By default, the admin.conf, kubectl and kubectl.sh files are generated.

You can use:

$ cd workspace/inventory/artifacts
$ ./kubectl.sh cluster-info

You can copy the kubectl file to your local bin (/usr/local/bin/) or better to install it yourself with autocomplete.

And then set the KUBECONFIG env var for kubectl to work:

$ cd workspace/inventory/artifacts
$ export KUBECONFIG=$(pwd)/admin.conf
$ # or if you want to use existing config
$ export KUBECONFIG=$KUBECONFIG:$(pwd)/admin.conf
$ # or
$ export KUBECONFIG=$HOME/.kube/config:$(pwd)/admin.conf

You can adjust the above script for ~/.bash_profile so that it's loaded everytime a terminal session is started.

Use it:

$ kubectl config use-context admin-cluster.local
$ kubectl cluster-info

See:

Configuration Override

To override default config, you need to create workspace/teracy-dev-entry/config_override.yaml to override the values from teracy-dev-k8s/config.yaml.

For example:

teracy-dev-k8s:
  ansible:
    mode: host
    verbose: vv
    host_vars:
      kubectl_localhost: "False"
      helm_enabled: "True"
  vm_memory: 1600
  vm_cpus: 4
  num_instances: 3

How to develop

Configure workspace/teracy-dev-entry/config_override.yaml with the following similar content:

teracy-dev:
  extensions:
    - _id: "entry-k8s" # make sure the right _id matching from the config_default.yaml file
      path:
        lookup: workspace
      location:
        git:
          remote:
            origin: [email protected]:hoatle/teracy-dev-k8s.git # your forked repo
          branch: develop
      require_version: ">= 0.4.0-SNAPSHOT"

Enjoy and happy hacking!

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.