From 7fbbf7797719db774f52d06e8b8898ecb4d87cac Mon Sep 17 00:00:00 2001 From: astrocket Date: Sun, 19 Apr 2020 16:44:24 +0900 Subject: [PATCH] update README.md --- k8s/README.md.tt | 24 +++++++++++++++--------- lib/tasks/deploy.rake.tt | 2 +- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/k8s/README.md.tt b/k8s/README.md.tt index df29068..dfe770b 100644 --- a/k8s/README.md.tt +++ b/k8s/README.md.tt @@ -143,6 +143,8 @@ kubectl create -f k8s/cluster/lets_encrypt_issuer.yaml Create Demo Ingress, Service, Pod. (to test configuration) +[k8s/demo.yaml](k8s/demo.yaml) + ```bash kubectl apply -f k8s/demo.yaml ``` @@ -182,13 +184,17 @@ It's recommended to manage resources seperately to prevent downtime while updati * `k8s/project/<%= k8s_name %>-nginx-conf.yaml` creates application level nginx's(* is different from ingress-nginx*) config-map, where we serve static files, redirect app traffic to puma. (It will be used when deploying k8s/app.yaml) ```bash -kubectl apply -f k8s/project/<%= k8s_name %>-nginx-conf.yaml -kubectl apply -f k8s/web.yaml -kubectl apply -f k8s/sidekiq.yaml -kubectl apply -f k8s/ingress.yaml +kubectl create secret generic <%= k8s_name %>-secrets --from-file=<%= k8s_name %>-master-key=config/master.key # push master.key to k8s secret +kubectl apply -f k8s/ingress.yaml # from load-balancer to web service +kubectl apply -f k8s/service.yaml # web service for web deployment +kubectl apply -f k8s/project/<%= k8s_name %>-nginx-conf.yaml # for web deployment's nginx +kubectl apply -f k8s/web.yaml # puma & nginx +kubectl apply -f k8s/sidekiq.yaml # sidekiq ... etc ``` +## Extra + ### Monitoring Commands #### Pod @@ -219,7 +225,7 @@ rails deploy:logs:web rails deploy:logs:sidekiq ``` -### Deployment Script +### Rails Tasks Execute multiple kubectl commands with rails task. @@ -229,7 +235,7 @@ rails deploy:demo:up rails deploy:demo:down # rollback # push master.key to kubernetes secret -rails deploy:production:set_maseter_key +rails deploy:production:set_master_key # apply production application nginx config # apply production ingress @@ -278,9 +284,9 @@ delete secrets kb delete secret <%= k8s_name %>-secrets ``` -## Tuning +### Tuning -### Puma +#### Puma `process * thread * pod replicas < db connection` @@ -292,7 +298,7 @@ kb delete secret <%= k8s_name %>-secrets You can customize application nginx through [config-map](k8s/project/<%= k8s_name %>-nginx-conf.yaml) as usual. -### Ingress Nginx +#### Ingress Nginx To make your service scalable, you should consider tuning your [ingress-nginx](https://kubernetes.github.io/ingress-nginx) as your needs. diff --git a/lib/tasks/deploy.rake.tt b/lib/tasks/deploy.rake.tt index f029841..ec02956 100644 --- a/lib/tasks/deploy.rake.tt +++ b/lib/tasks/deploy.rake.tt @@ -47,7 +47,7 @@ namespace :deploy do sh("docker push #{image_tag}") end - task :set_maseter_key => :environment do + task :set_master_key => :environment do sh("kubectl create secret generic <%= k8s_name %>-secrets --from-file=<%= k8s_name %>-master-key=config/master.key") end