<p>I’m having really hard time trying to construct workflow with k8s that would include:</p>
<ul>
<li>Having <strong>monorepo</strong> for multiple microservices</li>
<li>Having <strong>single command to start</strong> all of them and being able to start local development</li>
<li>Having <code>docker-like</code> experience of installing entire infrastructure on another machine that has no k8s installed on it (for local development) 1. <code>git pull</code> 2. <code>k8s start</code>, 3. wait, 4. <code>ping localhost:3000</code> would be goal here.</li>
<li>Being able to have <strong>changes in my local files instantly applied</strong> to services without rebuilding images etc (something similar to docker volumes I guess)</li>
<li>Having <strong>modular config</strong> files where there is one root config file for infrastructure that is referencing to services smaller configs</li>
</ul>
<p>I was looking hard for some example or guide about constructing such system without luck.</p>
<p>Am I missing something important about k8s design that makes me look for something not really possible witk k8s?</p>
<p><strong>Why I think such question should not be closed</strong></p>
<ul>
<li><p>There are many developers without dev-ops experience trying their best with microservices and I've found lack of some solid guide about such (and very common) use case</p>
</li>
<li><p>There is no clear guide about smooth local development experience with rapid feedback loop when it comes to k8s.</p>
</li>
<li><p>While it's opinion based, I find this question being more focused on general directions that would lead to such developer experience, rather than exact steps.</p>
<p>I'm not even sure (and I was trying to find out) if it's considered good practice for professional dev-ops. I have no idea how big infrastructures (tens or hundreds of microservices) are managed. Is it possible to run them all on single machine? Is it desired?</p>
</li>
</ul>

<p>I built something similar to what you're asking before. I ran <code>hyperkube</code> manually, which is hardly recommended but did the trick for local development. In my case this was all running in Vagrant for team uniformity.</p>

<pre><code>docker run -d --name=kubelet \
        --volume=/:/rootfs:ro \
        --volume=/sys:/sys:ro \
        --volume=/var/lib/docker/:/var/lib/docker:rw \
        --volume=/var/lib/kubelet/:/var/lib/kubelet:slave \
        --volume=/var/run:/var/run:rw \
        --net=host \
        --pid=host \
        --privileged \
        --restart=always \
        gcr.io/google_containers/hyperkube-${ARCH}:${K8S_VERSION} \
        /hyperkube kubelet \
            --containerized \
            --hostname-override=127.0.0.1 \
            --api-servers=http://localhost:8080 \
            --cluster-dns=10.0.0.10 \
            --cluster-domain=cluster.local \
            --allow-privileged --v=2 \
            --image-gc-high-threshold=50 \
            --image-gc-low-threshold=40 \
            --kube-api-qps 1000 --kube-api-burst=2000 \
            --pod-manifest-path=/etc/kubernetes/manifests
</code></pre>

<p>On top of this, I had build scripts that would use YAML <a href="https://mustache.github.io/" rel="nofollow noreferrer">mustache</a> templates that were aware where this was being deployed. When this was being deployed locally, every pod had the source code mounted as a volume so I could auto-reload it.</p>

<p>The same scripts were able to deploy to production thanks to it all being based on mustache templates. I even had multiple configuration files that would apply different template values for different environments.</p>

<p>The build script would prepare the YAML templates, build whatever images it needs to build, apply to Kubernetes and from there it would just auto-reload. It was a semi-nice user experience. My main issue was sluggishness when it come to file updating because it was running inside Docker inside Vagrant. There was no file sharing type that would provide good performance for both client and server <strong>and</strong> allow for file watching (<code>inotify</code> didn't work with most file share types, and NFS/SMB was slow for IDEs).</p>

<p>It was my first Kubernetes experience, so I doubt it's the "recommended way", but it worked. There was a lot of scripting involved so there are probably better ways to do this today.</p>
