{"id":18445643,"url":"https://github.com/voronenko/win-k8s-croco","last_synced_at":"2026-04-30T22:38:22.366Z","repository":{"id":145345886,"uuid":"142578367","full_name":"Voronenko/win-k8s-croco","owner":"Voronenko","description":"Fun POC on using kubernetes built-in into docker for windows","archived":false,"fork":false,"pushed_at":"2020-10-22T10:31:10.000Z","size":253,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T05:36:26.317Z","etag":null,"topics":["crocohunter","docker","k8s","windows"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Voronenko.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-27T13:06:19.000Z","updated_at":"2022-05-16T16:47:00.000Z","dependencies_parsed_at":"2024-04-19T08:15:44.692Z","dependency_job_id":null,"html_url":"https://github.com/Voronenko/win-k8s-croco","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Voronenko/win-k8s-croco","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fwin-k8s-croco","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fwin-k8s-croco/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fwin-k8s-croco/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fwin-k8s-croco/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Voronenko","download_url":"https://codeload.github.com/Voronenko/win-k8s-croco/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fwin-k8s-croco/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32479448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crocohunter","docker","k8s","windows"],"created_at":"2024-11-06T07:06:41.443Z","updated_at":"2026-04-30T22:38:17.358Z","avatar_url":"https://github.com/Voronenko.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Built-in kubernetes in docker for windows as a quick alternative to minikube.\n\nI am a linux guy, but one of my work boxes is Intel NUC under windows with quite good memory specs.\nSo far I was using it to offload docker builds and use some VMs on a hyperV. Latest docker update\nhas made things even more interesting - Docker for windows now is capable to run single node Kubernetes 1.1x \ncluster, which you can use for your experiments as well.\n\n![UI](https://raw.githubusercontent.com/Voronenko/win-k8s-croco/master/images/kubernetes_1.png \"Kubernetes on Docker for windows\")\n\n\nEven if Windows has WSL, it still does not behave in a way how my usual linux workplace does, this on my local lab first (note: insecure) step I do - is exposing my windows kubernetes and docker ports to my linux notebook\n\nExpose docker tcp daemon on 2375\n\n```cmd\nSET EXTERNAL_IP=192.168.2.2\nnetsh interface portproxy add v4tov4 listenport=2375 connectaddress=127.0.0.1 connectport=2375 listenaddress=%EXTERNAL_IP% protocol=tcp\n```\n\nExpose \n\n```\nSET EXTERNAL_IP=192.168.2.2\nnetsh interface portproxy add v4tov4 listenport=6445 connectaddress=127.0.0.1 connectport=6445 listenaddress=%EXTERNAL_IP% protocol=tcp\n```\n\n## Accessing your cluster with kubectl from your linux machine:\n\nby default docker patches your windows kube config with changes similar to below:\n\n```\napiVersion: v1\nclusters:\n- cluster:\n    insecure-skip-tls-verify: true\n    server: https://localhost:6445\n  name: docker-for-desktop-cluster\ncontexts:\n- context:\n    cluster: docker-for-desktop-cluster\n    user: docker-for-desktop\n  name: docker-for-desktop\ncurrent-context: docker-for-desktop-cluster\nkind: Config\npreferences: {}\nusers:\n- name: docker-for-desktop\n  user:\n    client-certificate-data: REDACTED\n    client-key-data: REDACTED\n```\n\nWhat you need - is to replicate config on your linux box, and tune server address to external interface address of your box.\n\nAfter that, you can see the context on your linux box\n\n```shell\nkubectx\ndocker-for-desktop\nMINIKUBE\n```\nand control it using native kubectl tool\n\n```shell\nkubectl get pods\nNAME       READY     STATUS      RESTARTS   AGE\ndns-test   0/1       Completed   0          23h\n```\n\nLets test install kubernetes dashboard, because docker for windows provides no specific UI for that part\n\n```sh\nkubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/alternative/kubernetes-dashboard.yaml\necho kubectl create -f k8s/dashboard-admin.yaml\n```\n\nNew release of dashboard comes with RBAC as a default, but for that specific case we can go on a simplier setup, and\nget admin rights from the start :  `kubectl create -f k8s/dashboard-admin.yaml` where  dashboard-admin.yaml is\n\n```yaml\napiVersion: rbac.authorization.k8s.io/v1beta1\nkind: ClusterRoleBinding\nmetadata:\n  name: kubernetes-dashboard\n  labels:\n    k8s-app: kubernetes-dashboard\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: ClusterRole\n  name: cluster-admin\nsubjects:\n- kind: ServiceAccount\n  name: kubernetes-dashboard\n  namespace: kube-system\n```\n\nNow you can run `kubectl proxy` in some console, and also some better control over kubernetes cluster, accessible on\n`http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default`\n\n\n![Dashboard](https://raw.githubusercontent.com/Voronenko/win-k8s-croco/master/images/kubernetes_2.png \"Kubernetes Dashboard\")\n\n\n## Prof of concept deployment\n\nNow lets test deploy CrocoHunter application\n\n`kubectl create -f croc-hunter.yaml --save-config`\n\n```yaml\n\napiVersion: v1\nkind: Service\nmetadata:\n  name: croc-hunter\n  labels:\n    component: croc-hunter\nspec:\n  ports:\n    - port: 8080\n      targetPort: 8080\n  selector:\n    component: croc-hunter\n  type: \"ClusterIP\"\n\n---\napiVersion: extensions/v1beta1\nkind: Deployment\nmetadata:\n  name: croc-hunter\n  labels:\n    component: croc-hunter\nspec:\n  replicas: 1\n  strategy:\n    type: RollingUpdate\n  selector:\n    matchLabels:\n      component: \"croc-hunter\"\n  template:\n    metadata:\n      labels:\n        component: \"croc-hunter\"\n    spec:\n      containers:\n        - name: croc-hunter\n          image: \"voronenko/docker-sample-image:47372c4\"\n          imagePullPolicy: \"Always\"\n          ports:\n          - name: http\n            containerPort: 8080\n          resources:\n            requests:\n              cpu: \"10m\"\n              memory: \"128Mi\"\n          livenessProbe:\n            httpGet:\n              path: /healthz\n              port: http\n          readinessProbe:\n            httpGet:\n              path: /healthz\n              port: http\n\n\n```\n\nand ingress to it\n\n```\napiVersion: extensions/v1beta1\nkind: Ingress\nmetadata:\n  annotations:\n     kubernetes.io/ingress.class: nginx\n  name: croc-hunter\nspec:\n  rules:\n  - http:\n      paths:\n      - path: /\n        backend:\n          serviceName: croc-hunter\n          servicePort: 8080\n```\n\nNow we can check, if application was deployed correctly:\n\n```shell\n\nkubectl get deployments\nNAME          DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\ncroc-hunter   1         1         1            0           48s\n\nkubectl get pods\nNAME                           READY     STATUS    RESTARTS   AGE\ncroc-hunter-55c74b5b69-sxn9b   1/1       Running   0          1m\n\n```\n\nDefinitely works. We can also access the application via kube proxy\n`http://localhost:8001/api/v1/namespaces/default/services/http:croc-hunter:/proxy/`\n\n\n![Hunter via proxy](https://raw.githubusercontent.com/Voronenko/win-k8s-croco/master/images/kubernetes_3.png \"Hunter exposed via proxy\")\n\n\n## Exposing deployment externally\n\nAs usual application has at least one endpoint that can be accessed externally,\nwe would like to emulate also that functionality (note: redhat minishift does this out of the box).\n\nWe might to it dirty the console, like\n\n```shell\n\nkubectl expose deployment croc-hunter --type=NodePort --name=croc-hunter-dirty-cmd\nservice \"croc-hunter-dirty-cmd\" exposed\n\nkubectl get services\nNAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE\ncroc-hunter             ClusterIP   10.106.108.70   \u003cnone\u003e        8080/TCP         29m\ncroc-hunter-dirty-cmd   NodePort    10.105.89.88    \u003cnone\u003e        8080:30815/TCP   31s\nkubernetes              ClusterIP   10.96.0.1       \u003cnone\u003e        443/TCP          1d\n\n```\n\nnote tcp port 30815 above.\n\n\nHow you can access exposed ports?\n\nOption (a), on the same windows box you can just navigate to http://127.0.0.1:30815/\n\n![Hunter accessible via port on localhost](https://raw.githubusercontent.com/Voronenko/win-k8s-croco/master/images/kubernetes_4.png \"Hunter accessible via port on localhost\")\n\n\n\nWe can achieve the same effect from the yaml definition\n\n```yaml\n\napiVersion: v1\nkind: Service\nmetadata:\n  name: croc-hunter-nodeport-service\n  labels:\n    component: croc-hunter\nspec:\n  ports:\n    - port: 8080\n      targetPort: 8080\n  selector:\n    component: croc-hunter\n  type: NodePort\n\n```\n\n```shell\n\nkubectl create -f croc-hunter-nodeport.yml --save-config\nservice \"croc-hunter-nodeport-service\" created\n\nkubectl get services\nNAME                           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE\ncroc-hunter                    ClusterIP   10.106.108.70   \u003cnone\u003e        8080/TCP         31m\ncroc-hunter-nodeport-service   NodePort    10.102.97.238   \u003cnone\u003e        8080:30688/TCP   6s\nkubernetes                     ClusterIP   10.96.0.1       \u003cnone\u003e        443/TCP          1d\n\n```\n\nnote tcp port as well `30688`.\n\n\nOption(b) - basically I am also able to access port exposed on a box from\nmy external linux box as well:\n\n\n![Hunter accessible on external network interface](https://raw.githubusercontent.com/Voronenko/win-k8s-croco/master/images/kubernetes_5.png \"Hunter accessible on external network interface\")\n\n\nWhich is kind of cool.\n\nSummary: you can use built-in single node kubernetes node for small playground with\nyour kubernetes experiments not only locally, but also on remote using set of tools\nyou.\n\nThanks!\n\n\n## Code in action: \n\nRepository with code snippets above:  https://github.com/Voronenko/win-k8s-croco\nCroco game image: https://github.com/voronenko-p/docker-sample-image which is slightly modified https://github.com/lachie83/croc-hunter (fixed absolute references to resources to allow proper run under proxy)\n\nfor the first time\n\n```sh\n\nmake deploy\n```\n\nfor subsequent...\n\n```sh\n\nmake apply \n```\n\nDebugging access - requires running `kubectl proxy` in background...\n\nLaunch kubernetes dashboard from url `http://localhost:8001/api/v1/namespaces/kube-system/services/http:kubernetes-dashboard:/proxy/#!/overview?namespace=default` if you have installed one\n\n```sh\n\nmake dashboard\n```\n\nLaunch deployed micro service `http://localhost:8001/api/v1/namespaces/default/services/http:croc-hunter:/proxy/`\n\n```sh\n\nmake hunter\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fwin-k8s-croco","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoronenko%2Fwin-k8s-croco","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fwin-k8s-croco/lists"}