项目作者: AndGasper

项目描述 :
Kubernetes beats
高级语言: HCL
项目地址: git://github.com/AndGasper/k8s-and-heartbreak.git
创建时间: 2019-11-30T06:03:37Z
项目社区:https://github.com/AndGasper/k8s-and-heartbreak

开源协议:

下载


K8’s and Heartbreak

Words = Albums

Deploy me!

  1. Build the docker images

    1. docker-compose build
  2. Deploy the app to Kubernetes as a stack using the compose file:

    1. export DOCKER_ORCHESTRATOR=kubernetes
    2. docker stack deploy k8s-and-heartbreak -c docker-compose.yml

Note:

  1. WARNING: experimental environment variable DOCKER_ORCHESTRATOR is set. Please use DOCKER_STACK_ORCHESTRATOR instead

Note: On windows, had to enable Kubernetes from the settings in docker

Kubernetes Debugging (Because why would anything work right the first time)

  • Having to debug the albums failure
  • Get the services
    1. kubectl get services
  1. NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  2. albums-here ClusterIP None <none> 55555/TCP 10m
  3. db ClusterIP None <none> 55555/TCP 20m
  4. kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 22m
  5. web ClusterIP None <none> 55555/TCP 20m
  6. web-published LoadBalancer 10.110.251.1 localhost 8080:32681/TCP 20m
  • Get the pods
  • Input:
    1. kubectl get pods
  • Output:

    1. kubectl get pods
    2. NAME READY STATUS RESTARTS AGE
    3. albums-dc8878d5d-6v464 0/1 CrashLoopBackOff 4 2m39s
    4. albums-dc8878d5d-ln9m2 0/1 CrashLoopBackOff 4 2m39s
    5. albums-dc8878d5d-mkpcj 0/1 CrashLoopBackOff 4 2m39s
    6. albums-dc8878d5d-rmgbv 0/1 CrashLoopBackOff 4 2m39s
    7. albums-dc8878d5d-zx898 0/1 CrashLoopBackOff 4 2m39s
    8. db-bbb557c66-7cb6j 1/1 Running 0 26m
    9. web-8658499d7c-8g4db 1/1 Running 0 26m
  • Get logs: kubectl logs albums-dc8878d5d-mkpcj

  • Example:
    1. Error: Unable to access jarfile /app/words.jar
  • Why?
    1. <artifactId>albums</artifactId>
    and then the Dockerfile points to /app/words.jar => wrong
    /app/albums.jar => correct
  • Question: How do I update a deployment?
  • Answer: ?