The Code

Easy to learn


Commands

{% highlight sh %} kubes init kubes docker build kubes docker push kubes compile kubes deploy kubes apply kubes get kubes exec kubes logs kubes delete -y {% endhighlight %}

Structure

{% highlight sh %} .kubes/resources ├── clock │ └── deployment.yaml ├── worker │ └── deployment.yaml └── web ├── deployment.yaml └── service.yaml {% endhighlight %}

Init Generator

{% highlight sh %} $ kubes init --app demo --repo user/repo ⎈ (gke-dev/demo) create .kubes/config.rb create .kubes/config/env/dev.rb create .kubes/config/env/prod.rb create .kubes/resources/web/deployment.yaml create .kubes/resources/web/deployment/dev.yaml create .kubes/resources/web/deployment/prod.yaml create .kubes/resources/web/service.yaml Initialized .kubes folder Updated .gitignore $ {% endhighlight %}

Deploy

{% highlight sh %} $ kubes deploy => docker build -t user/demo-web:kubes-2020-06-19T00-20-28-1ef4db6 -f Dockerfile . Successfully built 1c5b10652c36 => docker push user/demo-web:kubes-2020-06-19T00-20-28-1ef4db6 Compiled .kubes/resources files Deploying kubes files => kubectl apply -f .kubes/output/web/service.yaml service/demo-web created => kubectl apply -f .kubes/output/web/deployment.yaml deployment.apps/demo-web created => kubectl apply -f .kubes/output/web/ingress.yaml ingress.networking.k8s.io/demo-web created $ {% endhighlight %}

YAML

{% highlight yaml %} --- apiVersion: apps/v1 kind: Deployment metadata: name: demo-web labels: app: demo namespace: default spec: replicas: 2 selector: matchLabels: app: demo template: metadata: labels: app: demo spec: containers: - name: demo-web image: <%= docker_image %> {% endhighlight %}

DSL

{% highlight ruby %} name "demo-web" namespace "default" labels(role: "web") replicas 2 image docker_image # IE: user/demo-web:kubes-2020-06-13T19-55-16-43afc6e {% endhighlight %}