jhipster kubectl - unable to decode " ": Object 'Kind' is missing

6/28/2017

When running this command:

kubectl apply -f tenten

I get this error:

unable to decode "tenten\.angular-cli.json": Object 'Kind' is missing in '{

"project": {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "name": "tenten"
},
"apps": [{
    "root": "src/main/webapp/",
    "outDir": "target/www/app",
    "assets": [
        "content",
        "favicon.ico"
    ],
    "index": "index.html",
    "main": "app/app.main.ts",
    "polyfills": "app/polyfills.ts",
    "test": "",
    "tsconfig": "../../../tsconfig.json",
    "prefix": "jhi",
    "mobile": false,
    "styles": [
        "content/scss/vendor.scss",
        "content/scss/global.scss"
    ],
    "scripts": []
}],
-- Thabo Mogašwa
jhipster
kubernetes

1 Answer

6/29/2017

It looks like you're running this from the parent directory of your applications. You should 1) create a directory that's parallel to your applications and 2) run yo jhipster:kubernetes in it. Then run kubectl apply -f tenten in that directory after you've built and pushed your docker images. For example, here's the output when I run it from the kubernetes directory in my jhipster-microservices-example project.

± yo jhipster:kubernetes

     _-----_
    |       |    ╭──────────────────────────────────────────╮
    |--(o)--|    │ Update available: 2.0.0 (current: 1.8.5) │
   `---------´   │     Run npm install -g yo to update.     │
    ( _´U`_ )    ╰──────────────────────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

⎈ [BETA] Welcome to the JHipster Kubernetes Generator ⎈
Files will be generated in folder: /Users/mraible/dev/jhipster-microservices-example/kubernetes
WARNING! kubectl 1.2 or later is not installed on your computer.
Make sure you have Kubernetes installed. Read http://kubernetes.io/docs/getting-started-guides/binary_release/


Found .yo-rc.json config file...
? Which *type* of application would you like to deploy? Microservice application
? Enter the root directory where your gateway(s) and microservices are located ../
2 applications found at /Users/mraible/dev/jhipster-microservices-example/

? Which applications do you want to include in your configuration? (Press <space> to select, <a> to toggle all, <i> to i
nverse selection)blog, store
JHipster registry detected as the service discovery and configuration provider used by your apps
? Enter the admin password used to secure the JHipster Registry admin
? What should we use for the Kubernetes namespace? default
? What should we use for the base Docker repository name? mraible
? What command should we use for push Docker image to repository? docker push

Checking Docker images in applications' directories...
ls: no such file or directory: /Users/mraible/dev/jhipster-microservices-example/blog/target/docker/blog-*.war
identical blog/blog-deployment.yml
identical blog/blog-service.yml
identical blog/blog-postgresql.yml
identical blog/blog-elasticsearch.yml
identical store/store-deployment.yml
identical store/store-service.yml
identical store/store-mongodb.yml
 conflict registry/jhipster-registry.yml
? Overwrite registry/jhipster-registry.yml? overwrite this and all others
    force registry/jhipster-registry.yml
    force registry/application-configmap.yml

WARNING! Kubernetes configuration generated with missing images!
To generate Docker image, please run:
  ./mvnw package -Pprod docker:build in /Users/mraible/dev/jhipster-microservices-example/blog

WARNING! 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 blog mraible/blog
  docker push mraible/blog
  docker image tag store mraible/store
  docker push mraible/store

You can deploy all your apps by running:
  kubectl apply -f registry
  kubectl apply -f blog
  kubectl apply -f store

Use these commands to find your application's IP addresses:
  kubectl get svc blog

See the end of my blog post Develop and Deploy Microservices with JHipster for more information.

-- Matt Raible
Source: StackOverflow