News for hackers. Stuff that matters.
Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @08:22AM (#16085142)
So confused by all the posts from people who say they run Swarm because kubernetes is too complicated or is only for huge deployments.

I’ve had all sort of difficulties installing Docker. By hand it’s not trivial to get a secure install. Docker machine is great except it’s often broken. The Docker machine dev team is a tired, understaffed bunch that’s always playing a sisyphean whack-a-mole against dozens of cloud providers and very needy posters on Github, myself included.

Kubernetes on the other hand is trivial with GKE. It’s great for single node deployments. I run a single node on GKE and it’s awesome, easy, and very cheap. You can even run preemptible instances. The myth that kubernetes is complicated is largely perpetuated by the same kind of people who say React is complicated: the people who’ve not tried it.

And like React, once you try kubernetes you never go back. Kubernetes is actually the orchestration equivalent of React. You declare what should be true, and Kubernetes takes care of the rest.

And the features it provides are useful for any-sized application! If you try kubernetes you quickly discover persistent volumes and statefulsets, which take away most of the complexities out of stateful applications (ie most applications). You also discover ingress resources and controllers, which make trivial so many things that are difficult with Swarm, like TLS termination. Swam doesn’t have such features, which any non-trivial app (say, Django, wordpress, etc) benefits from tremendously.

Re:Docker for Mac with Kubernetes by drdaeman on Saturday January 06, 2018 @09:54AM (#16085491)
> Kubernetes on the other hand is trivial with GKE

How do I install GKE on my servers? ;)

> By hand it’s not trivial to get a secure install.

The default install (basically, adding a repo and apt-get install docker-ce on Debian and derivatives - trivial to automate with Ansible) is reasonably secure if you view Docker as a tool for packaging and task scheduling with some nice extras and don't buy the marketed isolation properties. It only listens for commands on a local socket, and permissions are sane. I haven't looked into Swarm mode protocol traffic, though but I don't think it's tweakable anyway.

> The myth that kubernetes is complicated is largely perpetuated by the same kind of people who say React is complicated: the people who’ve not tried it.

I've tried K8s. I've set up a test cluster, it worked, I wrote some YAML, it worked, all good. So I've worsened the conditions (explicitly going into "I want things to break" territory) and made it fail. I've researched how hard it is to diagnose the problem and fix it - it happened to be complicated. At least, for me. Just felt that "if something goes wrong here, I'll have bad time trying to fix it". Surely, this is not the case on GKE where you don't run and don't manage the cluster.

I had somewhat similar experience with Docker and Docker Swarm mode, and it was significantly easier to dive into the code, find out the relevant parts and see what's going on.

> difficult with Swarm, like TLS termination

YMMV, but I just add some labels to the service and Traefik does the rest. ;)

(But, yeah, Traefik with Swarm requires some reasonable but not exactly obvious networking logic. May take one deployment of "why I'm getting 504s?!" to figure it out. And Traefik needs access to manager nodes to work with built-in Swarm service discovery.)

Re:Docker for Mac with Kubernetes by pacala on Saturday January 06, 2018 @12:01PM (#16086100)
> How do I install GKE on my servers? ;)

Great question! All major Cloud providers offer managed Kubernetes services:

https://cloud.google.com/kubernetes-engine

https://azure.microsoft.com/en-us/services/container-service

https://aws.amazon.com/eks

https://www.ibm.com/cloud/container-service

The choice is Cloud + Kubernetes vs. roll everything on your own hardware.

Running your own hardware is a major IT effort. Kubernetes is just a part of that effort. Then you have take care about planning, provisioning, logging, monitoring, alerting, auditing, networking, storage, oncall.

You either run Cloud + Kubernetes and get rolling in 15 minutes, or you hire IT headcount.

Re:Docker for Mac with Kubernetes by bboreham on Saturday January 06, 2018 @12:12PM (#16086186)
EKS isn't generally available
Re:Docker for Mac with Kubernetes by bonesss on Monday January 08, 2018 @08:23AM (#16096506)
> Running your own hardware is a major IT effort. Kubernetes is just a part of that effort.

For Enterprise nerds VMWare has also just launched a Kubernetes service, so the #1 Enterprise VM supplier just added k8s on-prem for everyone who is in a hybrid cloud situation.

Re:Docker for Mac with Kubernetes by ownagefool on Saturday January 06, 2018 @05:16PM (#16087774)
Re:Docker for Mac with Kubernetes by kuschku on Saturday January 06, 2018 @12:28PM (#16086313)
> You either run Cloud + Kubernetes and get rolling in 15 minutes, or you hire IT headcount.

You can always rent dedicated hardware – much cheaper than renting similar amounts of virtual servers, and the same administration and operations costs. It’s often even significantly cheaper than what GCE offers – but of course, setting up Kubernetes is more complicated.

Re:Docker for Mac with Kubernetes by pacala on Saturday January 06, 2018 @03:25PM (#16087258)
Exactly. Hardware rental is one way to tackle provisioning. You're still left with all the other tasks required to bootstrap your own datacenter. As you build up the roll-your-own solution, you end up in the same place: hire IT headcount.

If you are a small startup looking to validate market fit, your best bet is Cloud + Kubernetes. If you are an established business with millions of daily customers and serious IT headcount budget, you may look into roll-your-own. The best orchestrator at that scale is, again, Kubernetes.

Re:Docker for Mac with Kubernetes by kuschku on Saturday January 06, 2018 @05:02PM (#16087725)
> Exactly. Hardware rental is one way to tackle provisioning. You're still left with all the other tasks required to bootstrap your own datacenter. As you build up the roll-your-own solution, you end up in the same place: hire IT headcount.

For a startup, building a datacenter isn’t required in the beginning.

I meant, literally renting existing hardware, in an existing datacenter. This is just a single step from renting VMs at AWS or GCE, but already improves costs significantly.

Re:Docker for Mac with Kubernetes by breeny592 on Sunday January 07, 2018 @05:17AM (#16090211)
I think pacala's point still stands - if you rent hardware, there is still a larger effort involved around running scalable services (DR, auto-scaling/load balancing, deployments etc). If you rent hardware, you likely will need a larger dedicated % of resources dedicated to maintaining that, over OOTB service providers.

Edit: got user names wrong

Re:Docker for Mac with Kubernetes by xchaotic on Wednesday January 10, 2018 @04:57AM (#16113743)
you still have to go from bare metal in someone else's DC to having you software running on top of it, who's going to do all that config work? You're spending resources either way.
Re:Docker for Mac with Kubernetes by kuschku on Wednesday January 10, 2018 @05:23AM (#16113873)
As I said before, thanks to container linux, that's 3 lines in a json config.

I've deployed a handful of servers automatically myself this way, and I'm still a student.

Saving about an order of magnitude in terms of costs, gaining flexibility, and the only additional work is so low that it costs a compsci student half an hour once (aka ~10€ in wages) — there's no reason not to do it.

Re:Docker for Mac with Kubernetes by sz4kerto on Saturday January 06, 2018 @04:20PM (#16087521)
That's not true in a whole lot of industries. Many (!) small shops simply can't choose the cloud because of various reasons (regulations, for example).
Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @10:10AM (#16085562)
Thanks for the reply.

I agree with what you say. I'm not tying to say people should all jump to k8s. Having options on the market is great.

But I was trying to refute the notion that Kubernetes has no advantages unless you're running a huge cluster. My main points where:

* It works great with 1 node.

* It comes with many features that Swarm does not have that are useful even at 1 node (PersistentVolumes, StatefulSets are biggest for me, though there are _many_ more I wouldn't want to go without anymore).

* Docker is not trivial to set up, either.

> How do I install GKE on my servers? ;)

Yes, of course. I was just saying there's a solid option to start exploring quickly.

> It only listens for commands on a local socket.

This is kind of a non-starter, isn't it? Of course it's easy to apt-get install docker, but then you want to control it remotely, right? Once you realize how nice it is to control Docker remotely, it's hard to imagine life before.

Re:Docker for Mac with Kubernetes by sandGorgon on Saturday January 06, 2018 @11:58AM (#16086080)
Actually if you are using StatefulSets and PV, then kubernetes is a better fit for you.

However, Swarm is undeniably simpler to work with unless you have very specific requirements that only K8S provides. The yml file is incredibly simpler.

Docker Swarm is the Kotlin to Kubernetes' Java. It's a much pleasanter and much less intimidating way to build production systems that scale pretty well.

Kubernetes needs you to have load balancers setup which can talk K8S ingress. Bare metal setup for k8s is a huge effort (and I have stuck long enough on #sig-metal to know) as compared to Swarm.

You should try out Swarm - you might choose not to use it, but you will enjoy the experience.

Re:Docker for Mac with Kubernetes by raarts on Saturday January 06, 2018 @04:05PM (#16087452)
Completely agree. Tried them both and found Docker Swarm to be much simpler to setup and maintain.
Re:Docker for Mac with Kubernetes by dominotw on Saturday January 06, 2018 @12:26PM (#16086306)
> Docker is not trivial to set up, either.

Do you have a concrete example of what you ran into? What do you mean by "secure install"?

on osx its just a matter on installing docker4mac and other linux distributions has pre-made packages. I am a linux noob and I was able to setup a 20 machine cluster with swarm trivially on centos7.

I was acutally surprised that I was able to do that so trivially, given I have minimal linux admin experience if any.

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @01:20PM (#16086636)
I’m referring to all the stuff Docker machine does beyond apt-get install docker. It sets up TLS certs and sockets do you can control the docker daemon remotely. When docker machine works it’s great, but when it doesn’t it’s frustrating.
Re:Docker for Mac with Kubernetes by dominotw on Saturday January 06, 2018 @02:24PM (#16086958)
Its built into docker swarm, afaik. You don't need to do anything special setup for TLS.

https://docs.docker.com/engine/swarm/how-swarm-mode-works/pk...

Re:Docker for Mac with Kubernetes by drdaeman on Saturday January 06, 2018 @12:11PM (#16086178)
> Kubernetes has no advantages unless you're running a huge cluster.

You're absolutely correct. Kubernetes has its advantages, even in a single-node setup. What many others are pointing out is that it also has significant disadvantages, too.

> but then you want to control it remotely, right?

By the way, I do talk to Docker (Swarm mode or standalone) deployments remotely, forwarding the socket via SSH.

    ssh -nNT -L /tmp/example.docker.sock:/run/docker.sock example.org
    docker -H unix:///tmp/example.docker.sock info
(Needs user to have access to the socket, of course. If sudo with password-requirements is desirable, `ssh + sudo socat` is a viable alternative.)

But, really, there is Ansible for this. Declare `docker_service` and get it deployed (or updated) as a part of the playbook. And ELK (with logging.driver=gelf for the containers or application-level) for logging.

(BTW, what's nice about K8s is that IIRC it allows to exec into pods with just `kubectl exec`. With Swarm you need some script to discover the the right node and container ID, SSH into it and run `docker exec` there - no remote access.)

Re:Docker for Mac with Kubernetes by perfmode on Saturday January 06, 2018 @10:15AM (#16085583)
I appreciate where you’re coming from, but you can’t bring GKE into a conversation about the challenges of Kubernetes ops. GKE does everything for you.
Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @10:59AM (#16085770)
I guess you are correct. What about Docker Machine vs Kops, then?
Re:Docker for Mac with Kubernetes by tokenizerrr on Saturday January 06, 2018 @11:55AM (#16086060)
You're running on GKE. Of course that's easy, they're handling all the difficult parts for you! It's still not that difficult running it on your own servers, but there are many more pain points.

Please get some experience with that, then re-evaluate whether Docker or Kubernetes is easier for small deployments.

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @01:24PM (#16086657)
Right, I agree.

But with your easier Swarm setup, how do you then attach cloud disks directly to your docker container, like a PersistentVolume affords? That one feature makes basically anything worth it, IMO. Most apps are stateful.

Re:Docker for Mac with Kubernetes by tokenizerrr on Saturday January 06, 2018 @02:04PM (#16086881)
You don't, because you're running on your own hardware, and there is no concept of cloud disks. There are some solutions like Ceph, but they're tough to setup.

Usually I just pin containers to hosts. This is fine on a small setup. In fact, many of my small setups are just a single host.

Re:Docker for Mac with Kubernetes by raarts on Saturday January 06, 2018 @04:07PM (#16087467)
> Ceph tough to setup

Try ProxMox. They have it built-in.

Re:Docker for Mac with Kubernetes by Bgd1 on Tuesday January 09, 2018 @06:13AM (#16105213)
Re:Docker for Mac with Kubernetes by jlawer on Sunday January 07, 2018 @10:17PM (#16094392)
NFS mounts, provisioned via the same configuration management platform the hardware is provisioned by (Saltstack in my case)
Re:Docker for Mac with Kubernetes by LaGrange on Saturday January 06, 2018 @09:08AM (#16085300)
"Kubernetes on the other hand is trivial with GKE."

Yes, true, but that's apple vs oranges. Swarm doesn't compete against GKE, it competes against Kubeadm. Because sometimes one actually can't or won't use cloud services.

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @10:57AM (#16085760)
I guess you are right, it's apple vs. oranges. If we take GKE out of the picture, in terms of setup, is it accurate to say it competes with Kops?
Re:Docker for Mac with Kubernetes by LaGrange on Saturday January 06, 2018 @03:13PM (#16087192)
Kops seem (from quick overview) to be focused on AWS and/or other cloud providers. Several times I've been limited either to actual hardware in a room, or a contracted provider giving me something along the lines of OpenStack. Unless there's a project I've missed, at the moment that means I either have to deal with kubeadm, or just roll from scratch myself (umm... nope).
Re:Docker for Mac with Kubernetes by dominotw on Saturday January 06, 2018 @08:56AM (#16085242)
GKE=Google cloud?

I don't understand ur comment, yea using something in preinstalled in the cloud is easier than installing something on your own.

Re:Docker for Mac with Kubernetes by tedmiston on Saturday January 06, 2018 @08:58AM (#16085249)
GKE = Google Kubernetes Engine (aka Google Container Engine for Kubernetes on Google Cloud Platform)

https://cloud.google.com/kubernetes-engine/

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @09:07AM (#16085296)
Docker isn't easy to install (see my OP). Kubernetes is probably more difficult to install, but it's not more expensive to use GKE than to roll your own Kubernetes elsewhere. And once you understand Kubernetes from a user perspecitve, it's easier to set up on your own.
Re:Docker for Mac with Kubernetes by kuschku on Saturday January 06, 2018 @12:38PM (#16086386)
> it's not more expensive to use GKE than to roll your own Kubernetes elsewhere.

$13 per month per egress rule, bandwidth costs a factor of 100 more expensive than dedicated hosters, and costs for hardware 10x of what dedicated hosters offer.

I’m not sure what your definition of "more expensive" is, but compared to renting dedicated hardware (e.g., from Hetzner), or colocating, GKE is significantly more expensive.

Of course, if you’re on the scale of Spotify, you can get much better deals – but from what I see on https://cloud.google.com/products/calculator/, it’s not cost-effective.

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @01:28PM (#16086680)
Maybe it’s my inexperience. I’ve not had to define egress rules yet. I run 1 preemptible n1-standard-2 node and pay for ancillary services. It’s $35-40/month.
Re:Docker for Mac with Kubernetes by kuschku on Saturday January 06, 2018 @01:48PM (#16086784)
I have the equivalent of 2 n1-standard-4 nodes (a bit more performant, actually), rented as dedicated servers, for $30 a month. Including egress and bandwidth.

That’s why I disagreed with the "GKE isn’t more expensive".

Re:Docker for Mac with Kubernetes by flylib on Saturday January 06, 2018 @01:52PM (#16086798)
"but it's not more expensive to use GKE than to roll your own Kubernetes elsewhere."

depends on what scale your at and the fact that your vendor locked, can't use GKE in other data centers

Re:Docker for Mac with Kubernetes by AlexCoventry on Saturday January 06, 2018 @04:00PM (#16087429)
I'm not proposing the following as a solution to your problem, which I'm sure is on a much larger scale, affording many opportunities for failure. I'm curious how it breaks in that context, though.

I regularly use a script like this, and it's never failed me unless it runs out of disk space: https://github.com/coventry/InformationDropout/blob/master/p...

Re:Docker for Mac with Kubernetes by moondev on Sunday January 07, 2018 @07:03AM (#16090527)
I agree for the most part, but kubernetes orchestrates docker (for now). It's also much easier to install than full blown k8s
Re:Docker for Mac with Kubernetes by tedmiston on Saturday January 06, 2018 @08:56AM (#16085243)
Do you really find k8s useful for a single node deployment or were you just making an example?

I haven't used but I have used DC/OS, Mesos, and Marathon extensively, which is not a setup I'd do for a small number of nodes personally.

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @09:01AM (#16085266)
Yes. Though I should emphasize that I'm using GKE. So it's zero config, zero ops. I am running a single n1-standard-2 node on GKE for a smallish app right now. Comes to 30-40 dollars a month all in (egress traffic, cloud storage, other services). I am working hard on getting people to use this app, and it's great to know that scaling will be best-in-class if I succeed.

But I stress it's not about the scaling. It's about the features even at a single node. I wouldn't be spending time writing this stuff had it not been revelatory for me.

PS. If you're not able to try it on GKE, there's also https://github.com/kubernetes/kops. GKE is great for trying, at least, though. Just get a cluster running and get rolling with the concepts. Then you'll know what it's all about. There isn't that much to it, and what there is to it is great and well documented with a great community.

Re:Docker for Mac with Kubernetes by Axsuul on Saturday January 06, 2018 @12:56PM (#16086504)
Yet with a Docker Swarm setup, you could get away with probably 10 dollars/month. K8s likely taking more resources than your app containers is why k8s may not be the best option for single node deployments.

I've personally tried both orchestration options and much prefer Swarm to smaller deployments. Sure k8s could prepare you better for the future if your app takes off to the moon but that's just premature optimization.

Re:Docker for Mac with Kubernetes by linkmotif on Saturday January 06, 2018 @01:29PM (#16086687)
This might all very well be true, but Swarm doesn’t let you connect cloud disks directly to your containers, to my knowledge.

Also I challenge the $10 because what cloud instances plus ancillary services add up to $10? I’m talking 2 CPUs and 7.5gb RAM.

Re:Docker for Mac with Kubernetes by Bgd1 on Tuesday January 09, 2018 @06:14AM (#16105223)
Re:Docker for Mac with Kubernetes by Axsuul on Saturday January 06, 2018 @03:17PM (#16087212)
A Digital Ocean droplet @ 1 GB runs at $10/mo which I have Docker Swarm + my app containers running on.
Re:Docker for Mac with Kubernetes by LaGrange on Saturday January 06, 2018 @09:12AM (#16085315)
I've found that both Swarm and k8s - but _especially_ the latter - makes the day-to-day application deployment really smooth compared to almost anything I used before (git-deploy, fabric, rsyncing things around). Docker containers are a large part of that, of course, but the tooling and configuration/secret handling help as well.
Re:Docker for Mac with Kubernetes by chrisgaun on Saturday January 06, 2018 @03:23PM (#16087243)
As a discloser, I work at Mesosphere who engineers DC/OS.

I would like to note that DC/OS now has Kubernetes [Beta]. You can manage Kubernetes resources on your DC/OS cluster now.

Here are the instructions on Github to get started: https://github.com/mesosphere/dcos-kubernetes-quickstart You can also join the Slack to help you on you out: http://chat.dcos.io/ (the #kubernetes channel)

Re:Docker for Mac with Kubernetes by dominotw on Saturday January 06, 2018 @11:35AM (#16085939)
>I have used DC/OS, Mesos, and Marathon extensively

Would you use DC/OS-marathon (vs k8s) now if you were to make that decision now.

I've heard that mesos stack is good for machine learning/big data stacks but how does marathon compare for deploying webapps.

Re:Docker for Mac with Kubernetes by nemothekid on Saturday January 06, 2018 @12:57PM (#16086513)
I've run 2 Mesos stacks in production and have experience setting up a k8s stack (on prem). First off in my experience k8s ops is way more complex that the DC/OS stack. I recently setup a new DC/OS deployment (80% of the cluster resources was Spark, which works natively with Mesos and I'd rather run the ancillary services on Marathon, then spend another 80% of my time on k8s). If I didn't have the Spark requirement I would have went k8s.

Despite going with mesos I really had to contend with the fact that k8s just has way, way more developer support - there are so many rich applications in the k8s sphere. Meanwhile I can probably name all the well supported Mesos frameworks offhand. Next, marathon "feels" dead. They recently killed their UI interface as I imagine that they are having trouble giving resources to marathon. 3 years ago I wanted a reverse proxy solution that integrated with mesos as well as non-mesos services so I hacked Caddy to make that work [1]. 3 years later, I was looking for a similar solution and found traefik. It claimed to work with mesos/marathon, but the marathon integration was broken and the mesos integration required polling even though mesos had an events API, so I hacked traefik to make that work [2]. On the other side of the fence, you have companies like Buoyant who rewrote a core piece of their tech (Linkerd) just to support K8s (and only K8s). This has a compounding effect, where over the years things will just become more reliant on assuming you are running k8s.

That "cost" you pay to setup Mesos/k8s is usually a one time cost on the order of a month. I feel however, that k8s is going to give you a better ROI (Unless, you are managing 100s of nodes with Spark/YARN/HDFS, then Mesos continues to be the clear winner).

[1] https://github.com/mholt/caddy/pull/40 [1] https://github.com/containous/traefik/pull/2617

Re:Docker for Mac with Kubernetes by mholt on Sunday January 07, 2018 @09:48PM (#16094292)
From me, an eternal thank-you for upgrading Caddy's proxy middleware!
Re:Docker for Mac with Kubernetes by tedmiston on Saturday January 06, 2018 @01:56PM (#16086827)
I think I need to try k8s in prod to give a good answer.

The DC/OS stack is nice for web apps, APIs, scheduled tasks, etc once you get it up and running. If I were just deploying small APIs and web apps, I would use something more managed like Lambda or Heroku/similar myself depending on the use case. That said, I'm more of an app dev than an ops person.

Re:Docker for Mac with Kubernetes by csmiller on Saturday January 06, 2018 @11:20AM (#16085869)
Have any recommended resources for learning Kubernetes? I've looked at it a few times, but it always seemed rather intimidating.
Re:Docker for Mac with Kubernetes by dankohn1 on Saturday January 06, 2018 @04:55PM (#16087690)
If you like videos, I recommend the free EdX course. If you don't I recommend the Katacoda interactive sessions.

https://kubernetes.io/docs/tutorials/

(Disclosure: I run CNCF, which hosts Kubernetes and funded the EdX course.)

Re:Docker for Mac with Kubernetes by bboreham on Saturday January 06, 2018 @12:16PM (#16086215)
Interactive tutorials from katacoda: https://www.katacoda.com/courses/kubernetes
Re:Docker for Mac with Kubernetes by dominotw on Saturday January 06, 2018 @11:22AM (#16085881)
manning book Kubernetes in action was easy( albeit a bit tedious) read.
Re:Docker for Mac with Kubernetes by jacksmith21006 on Saturday January 06, 2018 @01:00PM (#16086525)
This! I wonder if people say it because it is what they heard or from actual experience? I found K8s far easier but seen people say otherwise and suspect there is a bit of an echochamber happening.
Re:Docker for Mac with Kubernetes by raarts on Saturday January 06, 2018 @04:12PM (#16087482)
I can't believe that you came to that conclusion after trying them both. Try comparing the config files for Swarm and k8s for the same system, the former are much shorter and simpler.