github.com/googlecloudplatform/kubernetes-workshops@v0.0.0-20180501174420-d8199445b2c3/bring-up/local-docker.md (about)

     1  # Local Docker Cluster Bring-Up
     2  
     3  ## Prereqs
     4  
     5  Docker installed and
     6  configured. [Docker Toolbox](https://docs.docker.com/toolbox/overview/)
     7  recommended.
     8  
     9  ## Start Kubernetes
    10  
    11  ```
    12  export K8S_VERSION=v1.2.4
    13  ```
    14  
    15  ```
    16  docker run \
    17      --volume=/:/rootfs:ro \
    18      --volume=/sys:/sys:ro \
    19      --volume=/var/lib/docker/:/var/lib/docker:rw \
    20      --volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
    21      --volume=/var/run:/var/run:rw \
    22      --net=host \
    23      --pid=host \
    24      --privileged=true \
    25      --name=kubelet \
    26      -d \
    27      gcr.io/google_containers/hyperkube-amd64:${K8S_VERSION} \
    28      /hyperkube kubelet \
    29          --containerized \
    30          --hostname-override="127.0.0.1" \
    31          --address="0.0.0.0" \
    32          --api-servers=http://localhost:8080 \
    33          --config=/etc/kubernetes/manifests \
    34          --cluster-dns=10.0.0.10 \
    35          --cluster-domain=cluster.local \
    36          --allow-privileged=true --v=2
    37  ```
    38  
    39  ## Setup Kubectl
    40  
    41  Download `kubectl` to your local directory, and add your local
    42  directory to your path:
    43  
    44  Mac OS X
    45  ```
    46  curl -O http://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/darwin/amd64/kubectl
    47  chmod 755 kubectl
    48  PATH=$PATH:$(pwd)
    49  ```
    50  
    51  Linux
    52  ```
    53  wget http://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl
    54  chmod 755 kubectl
    55  PATH=$PATH:$(pwd)
    56  ```
    57  
    58  Windows (with bash)
    59  ```
    60  wget http://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/windows/amd64/kubectl.exe
    61  chmod 755 kubectl
    62  PATH=$PATH:$(pwd)
    63  ```
    64  ## Windows / Mac OS X
    65  
    66  In another terminal, create an ssh tunnel for kubectl to talk to your cluster. Leave this running.
    67  
    68  ```
    69  docker-machine ssh $(docker-machine active) -N -L 8080:localhost:8080
    70  ```
    71  ## Create kubernetes cluster configuration (Optional)
    72  
    73  ```
    74  kubectl config set-cluster test-doc --server=http://localhost:8080
    75  kubectl config set-context test-doc --cluster=test-doc
    76  kubectl config use-context test-doc
    77  ```
    78  
    79  ## Check that your cluster is running
    80  
    81  ```
    82  kubectl get nodes
    83  ```
    84  ```
    85  NAME        STATUS    AGE
    86  127.0.0.1   Ready     2s
    87  ```
    88  ## Start DNS
    89  
    90  ```
    91  kubectl create -f ./skydns.yaml
    92  ```
    93  ```
    94  replicationcontroller "kube-dns-v11" created
    95  service "kube-dns" created
    96  ```