Code Monkey home page Code Monkey logo

nsolid-kubernetes's Introduction

N|Solid, Docker, and Kubernetes

Overview

This repository is for deploying N|Solid with Kubernetes. It assumes that Kubernetes is already setup for your environment.

N|Solid, Docker, and Kubernetes

Table of Contents

local

Existing nsolid-kubernetes installs can be upgraded running the following command:

kubectl apply -f conf/nsolid.quickstart.yml

Cloud

If deployed to a cloud (AWS, Azure, GCP, Bluemix) please make sure to make the necessary adjustments to conf/nsolid.cloud.yml

kubectl apply -f conf/nsolid.cloud.yml
./install

Notes:

  1. Make sure your kubectl is pointing to your active cluster.
  2. If your cluster is a Bluemix Lite cluster, make this adjustment to conf/nsolid.services.yml before running ./install.

This command will install the N|Solid Console and a secure HTTPS proxy to the nsolid namespace.

It can take a little while for Kubernetes to download the N|Solid Docker images. You can verify that they are active by running:

kubectl --namespace=nsolid get pods

When all three pods (console and nginx-secure-proxy) have a status of 'Running', you may continue to access the N|Solid Console.

Secure credentials

  • Default username: nsolid
  • Default password: demo

With minikube

printf "\nhttps://$(minikube ip):$(kubectl get svc nginx-secure-proxy --namespace=nsolid --output='jsonpath={.spec.ports[1].nodePort}')\n"

or

Cloud Deployment:

kubectl get svc nginx-secure-proxy --namespace=nsolid

Open EXTERNAL-IP. If using Bluemix Lite cluster, get EXTERNAL-IP this way.

NOTE: You will need to ignore the security warning on the self signed certificate to proceed.

Welcome Screen

kubectl delete ns nsolid --cascade

Quick Start

cd sample-app
docker build -t sample-app:v1 .
kubectl create -f sample-app.service.yml
kubectl create -f sample-app.deployment.yml

NOTE: the container image in sample-app.deployment.yml must be set to match your docker image name. E.g. if you are using minikube and ran eval $(minikube docker-env), set the image to:

    spec:
      containers:
        - name: sample-app
          image: sample-app:v1

If you are working in a cloud environment, you will need to push the sample-app to a public Docker registry like Docker Hub, Quay.io, the Azure Container Registry, or the IBM Bluemix Container Registry, and update the sample-app Deployment file.

NOTE: Assumes kubectl is configured and pointed at your Kubernetes cluster properly.

kubectl create -f conf/nsolid.namespace.yml
openssl req -x509 -nodes -newkey rsa:2048 -keyout conf/certs/nsolid-nginx.key -out conf/certs/nsolid-nginx.crt
rm ./conf/nginx/htpasswd
htpasswd -cb ./conf/nginx/htpasswd {username} {password}
kubectl create secret generic nginx-tls --from-file=conf/certs --namespace=nsolid
kubectl create configmap nginx-config --from-file=conf/nginx --namespace=nsolid
kubectl create -f conf/nsolid.services.yml

Note: If your cluster is a Bluemix Lite cluster, make this adjustment to conf/nsolid.services.yml before running kubectl create.

Create persistent disks

N|Solid components require persistent storage. Kubernetes does not (yet!) automatically handle provisioning of disks consistently across all cloud providers. As such, you will need to manually create the persistent volumes.

Make sure the zone matches the zone you brought up your cluster in!

gcloud compute disks create --size 10GB nsolid-console

We need to create our disks and then update the volumeIds in conf/nsolid.persistent.aws.yml.

Make sure the zone matches the zone you brought up your cluster in!

aws ec2 create-volume --availability-zone eu-west-1a --size 10 --volume-type gp2

There's no need to explicitly create a persistent disk, since the Azure Container Service provides a default StorageClass, which will dynamically create them as needed (e.g. when a Pod includes a PersistentVolumeClaim).

There's no need to explicitly create a persistent disk, since the Bluemix Container Service provides a default StorageClass, which will dynamically create them as needed (e.g. when a Pod includes a PersistentVolumeClaim).

Configure Kubernetes to utilize the newly created persistent volumes

GCE
kubectl create -f conf/nsolid.persistent.gce.yml
AWS
kubectl create -f conf/nsolid.persistent.aws.yml
Azure

There's no need to explicitly create a PersistentVolume object, since they will be dynamically provisioned by the default StorageClass.

Bluemix

There's no need to explicitly create a PersistentVolume object, since they will be dynamically provisioned by the default StorageClass.

Deploy N|Solid components

kubectl create -f conf/nsolid.cloud.yml

Make sure your docker image is build on top of nodesource/nsolid:carbon-latest.

FROM nodesource/nsolid:carbon-latest

When defining your application make sure the following ENV are set.

  env:
    - name: NSOLID_APPNAME
      value: sample-app
    - name: NSOLID_COMMAND
      value: "console.nsolid:9001"
    - name: NSOLID_DATA
      value: "console.nsolid:9002"
    - name: NSOLID_BULK
      value: "console.nsolid:9003"

Optional flags:

  env:
    - name: NSOLID_TAGS
      value: "nsolid-carbon,staging"

A comma separate list of tags that can be used to filter processes in the N|Solid Console.

kubectl get svc {service-name}

The EXTERNAL-IP will access the application.
Open EXTERNAL-IP. If using Bluemix Lite cluster, get EXTERNAL-IP this way.

Make sure you use the --namespace=nsolid flag on all kubectl commands.

kubectl config current-context // outputs current context
kubectl config set-context {$context} --namespace=nsolid // make 'nsolid' the default namespace
kubectl config set-context {$context} --namespace=default // revert to default

Verify CLI:

kubectl exec {pod-name} -- nsolid-cli --remote=http://console.nsolid:6753 ping

See N|Solid cli docs for more info.

Minikube is a bit different then a normal Kubernetes install. The DNS service isn't running so discovering is a bit more involved. IP addresses are not dynamically assigned, instead we must use the host ports the service is mapped to.

If your doing a lot of work with docker and minikube it is recommended that you run the following:

eval $(minikube docker-env)

Get the kubernetes cluster ip address:

minikube ip

To get the service port:

kubectl get svc {$service-name} --output='jsonpath={.spec.ports[0].nodePort}'

Note: If your service exposes multiple ports you may want to examine with --output='json' instead.

If you get the following message when trying to run docker build or communicating with the Kubernetes API.

Error response from daemon: client is newer than server (client API version: 1.24, server API version: 1.23)

Export the DOCKER_API_VERSION to match the server API version.

export DOCKER_API_VERSION=1.23

nsolid-kubernetes is Copyright (c) 2018 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.

nsolid-kubernetes's People

Contributors

cvignola avatar dshaw avatar lostintangent avatar nw avatar rosskukulinski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nsolid-kubernetes's Issues

User/Password

Hi, i've manage to configure my node app through nsolid in kubernetes but the thing is i want to change
the default username and password?

Can anyone help me and tell me how i can achieve that?

Thank you

Include myapp and controller/services

I don't think the getting-started tutorial for GKE should have users dockerize their own application. That can be a 'what to do next' step at the very end.

I recommend including a demonstration application, controller, and service that can easily be deployed & scaled so the user can see what happens. Once they "get it", then they'll want to actually try their own application.

nsolid-etcd shouldn't use host volumes

In general, it's frowned upon to use hostNetwork and host volumes in Kubernetes. I know etcd is a bit of a magical dragon when it comes to clustering, but we should look to utilize GKE persistentStorage instead of host volumes for persistent data.

I've done work getting RethinkDB (which uses its own Raft implementation) to play nice in Kubernetes and that may be helpful in this process.

License Key is not persisted

License keys are not currently being persisted as our default nsolid-console Dockerfile uses /root/.config/nsolid-console for storing the config file, as opposed to /var/lib/nsolid/console/ which is mounted using a persistentVolume in Kubernetes.

nginx-secure-proxy stuck with pending external ip

I tried the setup this morning, twice to be sure, but once I setup the AWS deploy of kuernetes I can access it's UI without issue. Once I run the install script here, everything appears to be fine until I run: kubectl get svc nginx-secure-proxy --namespace=nsolid

NAME                 CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
nginx-secure-proxy   10.0.121.203   <pending>     80/TCP,443/TCP   21m

It just sits in this state, I can't get it to load the nsolid console so I can start trying it out :)

Conslidate n|solid yaml files

Kubernetes API definition supports a Lists type, so you can have one file that includes a number of sub-items.

Let's make it easier for users so they only have to start one (or two) kube scripts to get n|solid up and running.

nsolid crashing consistently

[ERROR] Resolving hostname to IP address has encountered an error: EAI_NONAME (unknown node or service)
on ../nsolid-ext/deps/agent/src/etcd_connector.cc:302
*** Error in `nsolid': free(): invalid pointer: 0x00000000023641e8 ***

server.js:

var http = require('http');
var os = require('os');
var hostname = os.hostname();

var port = process.env.PORT || 3000;

function handleRequest (request, response) {
  response.end('[' + hostname + '] Serving requests from myapp. Request URL:' + request.url);
}

var server = http.createServer(handleRequest);

server.listen(port, function () {
  console.log('Server listening on port', port);
});

NGINX Config Update Needed To Get Forwarded IP

I'd like to be able to get access to the actual IP address without creating a fancy ingress service. I've done some digging and it appears the following needs to be added to the nginx.config.

set_real_ip_from 127.0.0.1;
set_real_ip_from 192.168.2.1;
real_ip_header X-Forwarded-For;

But, I'm not sure what the IP addresses should be? All of the traffic trusted? 0.0.0.0/0? For my deployment, I'm on GCP.

Here's the NGINX doc for reference: http://nginx.org/en/docs/http/ngx_http_realip_module.html

And here's how to do it with Cloudflare: https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-

Update to v1.4.1

nsolid-runtime image for v1.4.1 just dropped. We should update the sample-app accordingly.

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.