Giter Club home page Giter Club logo

for-k8s's Introduction

Deploying with Kubernetes

Preparation

Generate Docker images by running the following command in the blog, gateway, and store directories.

mvnw package -Pprod -DskipTests jib:dockerBuild

You will need to push your image to a registry. If you have not done so, use the following commands to tag and push the images:

$ docker image tag gateway ustcck/gateway
$ docker push ustcck/gateway
$ docker image tag blog ustcck/blog
$ docker push ustcck/blog
$ docker image tag store ustcck/store
$ docker push ustcck/store

Deployment

You can deploy all your apps by running the below bash command:

./kubectl-apply.sh

Exploring your services

Use these commands to find your application's IP addresses:

$ kubectl get svc gateway

Scaling your deployments

You can scale your apps using

$ kubectl scale deployment <app-name> --replicas <replica-count>

zero-downtime deployments

The default way to update a running app in kubernetes, is to deploy a new image tag to your docker registry and then deploy it using

$ kubectl set image deployment/<app-name>-app <app-name>=<new-image>

Using livenessProbes and readinessProbe allow you to tell Kubernetes about the state of your applications, in order to ensure availablity of your services. You will need minimum 2 replicas for every application deployment if you want to have zero-downtime deployed. This is because the rolling upgrade strategy first kills a running replica in order to place a new. Running only one replica, will cause a short downtime during upgrades.

Monitoring tools

JHipster console

Your application logs can be found in JHipster console (powered by Kibana). You can find its service details by

$ kubectl get svc jhipster-console
  • If you have chosen Ingress, then you should be able to access Kibana using the given ingress domain.
  • If you have chosen NodePort, then point your browser to an IP of any of your nodes and use the node port described in the output.
  • If you have chosen LoadBalancer, then use the IaaS provided LB IP

JHipster registry

The registry is deployed using a headless service in kubernetes, so the primary service has no IP address, and cannot get a node port. You can create a secondary service for any type, using:

$ kubectl expose service jhipster-registry --type=NodePort --name=exposed-registry

and explore the details using

$ kubectl get svc exposed-registry

For scaling the JHipster registry, use

$ kubectl scale statefulset jhipster-registry --replicas 3

Troubleshooting

my apps doesn't get pulled, because of 'imagePullBackof'

Check the docker registry your Kubernetes cluster is accessing. If you are using a private registry, you should add it to your namespace by kubectl create secret docker-registry (check the docs for more info)

my applications get killed, before they can boot up

This can occur if your cluster has low resource (e.g. Minikube). Increase the initialDelaySeconds value of livenessProbe of your deployments

my applications are starting very slow, despite I have a cluster with many resources

The default setting are optimized for middle-scale clusters. You are free to increase the JAVA_OPTS environment variable, and resource requests and limits to improve the performance. Be careful!

for-k8s's People

Contributors

ustcck avatar

Watchers

 avatar  avatar

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.