toy-k8s

module
v0.0.0-...-cb9e437 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT

README

toy-k8s

(学習用)自作k8s

Kubernetes is a system for automating deployment, scaling, and management of containerized applications. This is a repository to learn how the components of a Kubernetes cluster works.

Local up example

Install etcd

Older etcd is needed. I use etcd v0.4.2

Build binaries
./src/scripts/build-go.sh
Run a local kubernetes cluster
(sudo) ./src/scripts/local-up-cluster.sh
Create a nginx pod
{
  "id": "nginxController",
  "desiredState": {
    "replicas": 1,
    "replicasInSet": {"name": "nginx"},
    "taskTemplate": {
      "desiredState": {
        "manifest": {
          "containers": [{
            "name": "nginx",
            "image": "nginx",
            "ports": [{"containerPort": 80, "hostPort": 8888}]
          }]
        }
      },
      "labels": {"name": "nginx"}
    }
  },
  "labels": {"name": "nginx"}
}

Note: one replica is only created on local.

(sudo) ./bin/cloudcfg -h http://127.0.0.1:8080 -c examples/nginx-controller.json create /replicationControllers
Check your running containers
docker ps
Delete the nginx container
docker kill [CONTAINER]
Wait a few seconds, check containers again
docker ps

References

Directories

Path Synopsis
cmd
pkg
api
Package api includes all types used to communicate between the various parts of the Kubernetes system.
Package api includes all types used to communicate between the various parts of the Kubernetes system.
apiserver
Package apiserver is ...
Package apiserver is ...
client
A client for the Kubernetes cluster management API There are three fundamental objects
A client for the Kubernetes cluster management API There are three fundamental objects
cloudcfg
Package cloudcfg is ...
Package cloudcfg is ...
kubelet
Package kubelet is ...
Package kubelet is ...
third_party

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL