Last active
June 11, 2016 19:31
-
-
Save tsandall/fe61da1c3da27261e715b7fdc455a4fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create kubeconfig for Kubelet: | |
| KUBECONFIG_CONTENTS=$(echo "apiVersion: v1 | |
| kind: Config | |
| users: | |
| - name: kubelet | |
| clusters: | |
| - name: kubemark | |
| cluster: | |
| insecure-skip-tls-verify: true | |
| server: http://172.17.0.1:8080 | |
| contexts: | |
| - context: | |
| cluster: kubemark | |
| user: kubelet | |
| name: kubemark-context | |
| current-context: kubemark-context" | base64 | tr -d "\n\r") | |
| KUBECONFIG_SECRET="./k8s-secret.json" | |
| cat > "${KUBECONFIG_SECRET}" << EOF | |
| { | |
| "apiVersion": "v1", | |
| "kind": "Secret", | |
| "metadata": { | |
| "name": "kubeconfig" | |
| }, | |
| "type": "Opaque", | |
| "data": { | |
| "kubeconfig": "${KUBECONFIG_CONTENTS}" | |
| } | |
| } | |
| EOF | |
| NODE_CONFIGMAP="./k8s-node-config.json" | |
| cat > "${NODE_CONFIGMAP}" << EOF | |
| { | |
| "apiVersion": "v1", | |
| "kind": "ConfigMap", | |
| "metadata": { | |
| "name": "node-configmap" | |
| }, | |
| "data": { | |
| "content.type": "" | |
| } | |
| } | |
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "kind": "ReplicationController", | |
| "apiVersion": "v1", | |
| "metadata": { | |
| "name": "hollow-node", | |
| "labels": { | |
| "name": "hollow-node" | |
| } | |
| }, | |
| "spec": { | |
| "replicas": 1, | |
| "selector": { | |
| "name": "hollow-node" | |
| }, | |
| "template": { | |
| "metadata": { | |
| "labels": { | |
| "name": "hollow-node" | |
| } | |
| }, | |
| "spec": { | |
| "volumes": [ | |
| { | |
| "name": "kubeconfig-volume", | |
| "secret": { | |
| "secretName": "kubeconfig" | |
| } | |
| } | |
| ], | |
| "containers": [ | |
| { | |
| "name": "hollow-kubelet", | |
| "image": "kubemark:latest", | |
| "ports": [ | |
| {"containerPort": 4194}, | |
| {"containerPort": 10250}, | |
| {"containerPort": 10255} | |
| ], | |
| "env": [ | |
| { | |
| "name": "CONTENT_TYPE", | |
| "valueFrom": { | |
| "configMapKeyRef": { | |
| "name": "node-configmap", | |
| "key": "content.type" | |
| } | |
| } | |
| } | |
| ], | |
| "command": [ | |
| "./kubemark.sh" | |
| ], | |
| "args": [ | |
| "--v=3", | |
| "--morph=kubelet", | |
| "$(CONTENT_TYPE)" | |
| ], | |
| "volumeMounts": [ | |
| { | |
| "name": "kubeconfig-volume", | |
| "mountPath": "/kubeconfig" | |
| } | |
| ], | |
| "resources": { | |
| "requests": { | |
| "cpu": "50m", | |
| "memory": "100M" | |
| } | |
| }, | |
| "imagePullPolicy": "Never" | |
| }, | |
| { | |
| "name": "hollow-proxy", | |
| "image": "kubemark:latest", | |
| "env": [ | |
| { | |
| "name": "CONTENT_TYPE", | |
| "valueFrom": { | |
| "configMapKeyRef": { | |
| "name": "node-configmap", | |
| "key": "content.type" | |
| } | |
| } | |
| } | |
| ], | |
| "command": [ | |
| "./kubemark.sh" | |
| ], | |
| "args": [ | |
| "--v=3", | |
| "--morph=proxy", | |
| "$(CONTENT_TYPE)" | |
| ], | |
| "volumeMounts": [ | |
| { | |
| "name": "kubeconfig-volume", | |
| "mountPath": "/kubeconfig" | |
| } | |
| ], | |
| "resources": { | |
| "requests": { | |
| "cpu": "20m", | |
| "memory": "100M" | |
| } | |
| }, | |
| "imagePullPolicy": "Never" | |
| }] | |
| } | |
| } | |
| } | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - $KUBE_SRC below refers to the path of the kubernetes source code | |
| - commit 1cce15659750d90064882738425115ec547c1634 | |
| - build using $KUBE_SRC/hack/build-go | |
| - output is stored in $KUBE_SRC/_output/... | |
| - kubemark:latest image is built by running "docker build -t kubemark:latest ." inside $KUBE_SRC/cluster/images/kubemark | |
| - need to copy kubemark binary into $KUBE_SRC/cluster/images/kubemark | |
| - hollow-node.json is taken from template in $KUBE_SRC/test/kubemark/resources/ | |
| - hardcode replicas | |
| - use kubemark:latest image instead of gcr.io version | |
| - added imagePullPolicy: Never to use locally built image (kubemark:latest) | |
| - master is started by running: API_HOST=0.0.0.0 $KUBE_SRC/hack/local-up-cluster.sh | |
| - API_HOST=0.0.0.0 is needed so that hollow-kubelet can reach apiserver | |
| - modify ADMISSION_CONTROL line in start_apiserver by removing ServiceAccount | |
| - ServiceAccount admission controller adds a volume to the test pods. The volume cannot be mounted by the hollow-node kubelet. | |
| - run gen_kubeconfig.sh to generate files used below | |
| - hollow-kubelet is started by running: | |
| kubectl create -f $KUBE_SRC/test/kubemark/resources/kubemark-ns.json | |
| kubectl create -f ./k8s-secret.json --namespace=kubemark | |
| kubectl create -f ./k8s-node-config.json --namespace=kubemark | |
| kubectl create -f ./k8s-hollow-node.json --namespace=kubemark | |
| - run kubectl cordon 127.0.0.1 to stop pods from being scheduled to default kubelet started by $KUBE_SRC/hack/local-up-cluster.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment