@@ -71,11 +71,12 @@ steps that existing cluster setup scripts are making.
7171 - [ Using Configuration Management] ( #using-configuration-management )
7272 - [ Bootstrapping the Cluster] ( #bootstrapping-the-cluster )
7373 - [ etcd] ( #etcd )
74- - [ Apiserver] ( #apiserver )
74+ - [ Apiserver, Controller Manager, and Scheduler ] ( #apiserver-controller-manager-and-scheduler )
7575 - [ Apiserver pod template] ( #apiserver-pod-template )
76- - [ Starting Apiserver] ( #starting-apiserver )
77- - [ Scheduler] ( #scheduler )
78- - [ Controller Manager] ( #controller-manager )
76+ - [ Cloud Providers] ( #cloud-providers )
77+ - [ Scheduler pod template] ( #scheduler-pod-template )
78+ - [ Controller Manager Template] ( #controller-manager-template )
79+ - [ Starting and Verifying Apiserver, Scheduler, and Controller Manager] ( #starting-and-verifying-apiserver-scheduler-and-controller-manager )
7980 - [ Logging] ( #logging )
8081 - [ Monitoring] ( #monitoring )
8182 - [ DNS] ( #dns )
@@ -97,7 +98,8 @@ steps that existing cluster setup scripts are making.
9798 up a temporary cluster by following one of the other Getting Started Guides.
9899 This will help you become familiar with the CLI ([ kubectl] ( ../user-guide/kubectl/kubectl.md ) ) and concepts ([ pods] ( ../user-guide/pods.md ) , [ services] ( ../user-guide/services.md ) , etc.) first.
99100 1 . You should have ` kubectl ` installed on your desktop. This will happen as a side
100- effect of completing one of the other Getting Started Guides.
101+ effect of completing one of the other Getting Started Guides. If not, follow the instructions
102+ [ here] ( ../user-guide/prereqs.md ) .
101103
102104### Cloud Provider
103105
@@ -537,38 +539,18 @@ To run an etcd instance:
5375391. make any modifications needed
5385401. start the pod by putting it into the kubelet manifest directory
539541
540- # ## Apiserver
542+ # ## Apiserver, Controller Manager, and Scheduler
541543
542- To run the apiserver :
543- 1. select the correct flags for your cluster
544- 1. write a pod spec for the apiserver using the provided template
545- 1. start the pod by putting it into the kubelet manifest directory
544+ The apiserver, controller manager, and scheduler will each run as a pod on the master node.
546545
547- Here are some apiserver flags you may need to set :
548- - ` --cloud-provider=`
549- - ` --cloud-config=` if cloud provider requires a config file (GCE, AWS). If so, need to put config file into apiserver image or mount through hostPath.
550- - ` --address=${MASTER_IP}` .
551- - or `--bind-address=127.0.0.1` and `--address=127.0.0.1` if you want to run a proxy on the master node.
552- - ` --cluster-name=$CLUSTER_NAME`
553- - ` --service-cluster-ip-range=$SERVICE_CLUSTER_IP_RANGE`
554- - ` --etcd-servers=http://127.0.0.1:4001`
555- - ` --tls-cert-file=/srv/kubernetes/server.cert`
556- - ` --tls-private-key-file=/srv/kubernetes/server.key`
557- - ` --admission-control=$RECOMMENDED_LIST`
558- - See [admission controllers](../admin/admission-controllers.md) for recommended arguments.
559- - ` --allow-privileged=true` , only if you trust your cluster user to run pods as root.
560-
561- If you are following the firewall-only security approach, then use these arguments :
562- - ` --token-auth-file=/dev/null`
563- - ` --insecure-bind-address=$MASTER_IP`
564- - ` --advertise-address=$MASTER_IP`
565-
566- If you are using the HTTPS approach, then set :
567- - ` --client-ca-file=/srv/kubernetes/ca.crt`
568- - ` --token-auth-file=/srv/kubernetes/known_tokens.csv`
569- - ` --basic-auth-file=/srv/kubernetes/basic_auth.csv`
546+ For each of these components, the steps to start them running are similar :
570547
571- *TODO* document proxy-ssh setup.
548+ 1. Start with a provided template for a pod.
549+ 1. Set the `APISERVER_IMAGE`, `CNTRLMNGR_IMAGE`, and `SCHEDULER_IMAGE to the values chosen in [Selecting Images](#selecting-images).
550+ 1. Determine which flags are needed for your cluster, using the advice below each template.
551+ 1. Set the `APISERVER_FLAGS`, `CNTRLMNGR_FLAGS, and `SCHEDULER_FLAGS` to the space-separated list of flags for that component.
552+ 1. Start the pod by putting the completed template into the kubelet manifest directory.
553+ 1. Verify that the pod is started.
572554
573555# ### Apiserver pod template
574556
@@ -588,7 +570,7 @@ If you are using the HTTPS approach, then set:
588570 "command": [
589571 "/bin/sh",
590572 "-c",
591- "/usr/local/bin/kube-apiserver $ARGS "
573+ "/usr/local/bin/kube-apiserver $APISERVER_FLAGS "
592574 ],
593575 "ports": [
594576 {
@@ -642,50 +624,66 @@ If you are using the HTTPS approach, then set:
642624}
643625` ` `
644626
645- The `/etc/ssl` mount allows the apiserver to find the SSL root certs so it can
646- authenticate external services, such as a cloud provider.
627+ Here are some apiserver flags you may need to set :
647628
648- The `/srv/kubernetes` mount allows the apiserver to read certs and credentials stored on the
649- node disk.
629+ - ` --cloud-provider=` see [cloud providers](#cloud-providers)
630+ - ` --cloud-config=` see [cloud providers](#cloud-providers)
631+ - ` --address=${MASTER_IP}` *or* `--bind-address=127.0.0.1` and `--address=127.0.0.1` if you want to run a proxy on the master node.
632+ - ` --cluster-name=$CLUSTER_NAME`
633+ - ` --service-cluster-ip-range=$SERVICE_CLUSTER_IP_RANGE`
634+ - ` --etcd-servers=http://127.0.0.1:4001`
635+ - ` --tls-cert-file=/srv/kubernetes/server.cert`
636+ - ` --tls-private-key-file=/srv/kubernetes/server.key`
637+ - ` --admission-control=$RECOMMENDED_LIST`
638+ - See [admission controllers](../admin/admission-controllers.md) for recommended arguments.
639+ - ` --allow-privileged=true` , only if you trust your cluster user to run pods as root.
650640
651- Optionally, you may want to mount `/var/log` as well and redirect output there.
641+ If you are following the firewall-only security approach, then use these arguments :
652642
653- # ### Starting Apiserver
643+ - ` --token-auth-file=/dev/null`
644+ - ` --insecure-bind-address=$MASTER_IP`
645+ - ` --advertise-address=$MASTER_IP`
654646
655- Place the completed pod template into the kubelet config dir
656- (whatever `--config=` argument of kubelet is set to, typically
657- ` /etc/kubernetes/manifests` ).
647+ If you are using the HTTPS approach, then set :
648+ - ` --client-ca-file=/srv/kubernetes/ca.crt`
649+ - ` --token-auth-file=/srv/kubernetes/known_tokens.csv`
650+ - ` --basic-auth-file=/srv/kubernetes/basic_auth.csv`
651+
652+ This pod mounts several node file system directories using the `hostPath` volumes. Their purposes are :
653+ - The `/etc/ssl` mount allows the apiserver to find the SSL root certs so it can
654+ authenticate external services, such as a cloud provider.
655+ - This is not required if you do not use a cloud provider (e.g. bare-metal).
656+ - The `/srv/kubernetes` mount allows the apiserver to read certs and credentials stored on the
657+ node disk. These could instead be stored on a persistend disk, such as a GCE PD, or baked into the image.
658+ - Optionally, you may want to mount `/var/log` as well and redirect output there (not shown in template).
659+ - Do this if you prefer your logs to be accessible from the root filesystem with tools like journalctl.
658660
659- Next, verify that kubelet has started a container for the apiserver :
661+ *TODO* document proxy-ssh setup.
660662
661- ` ` ` console
662- $ sudo docker ps | grep apiserver:
663- 5783290746d5 gcr.io/google_containers/kube-apiserver:e36bf367342b5a80d7467fd7611ad873 "/bin/sh -c '/usr/lo'" 10 seconds ago Up 9 seconds k8s_kube-apiserver.feb145e7_kube-apiserver-kubernetes-master_default_eaebc600cf80dae59902b44225f2fc0a_225a4695
664- ` ` `
663+ # #### Cloud Providers
665664
666- Then try to connect to the apiserver :
665+ Apiserver supports several cloud providers.
667666
668- ` ` ` console
669- $ echo $(curl -s http://localhost:8080/healthz)
670- ok
671- $ curl -s http://localhost:8080/api
672- {
673- "versions": [
674- "v1beta3",
675- "v1"
676- ]
677- }
678- ` ` `
667+ - options for `--cloud-provider` flag are `aws`, `gce`, `mesos`, `openshift`, `ovirt`, `rackspace`, `vagrant`, or unset.
668+ - unset used for e.g. bare metal setups.
669+ - support for new IaaS is added by contributing code [here](../../pkg/cloudprovider/)
679670
680- If you have selected the `--register-node=true` option for kubelets, they will now being self-registering with the apiserver.
681- You should soon be able to see all your nodes by running the `kubect get nodes` command.
682- Otherwise, you will need to manually create node objects.
671+ Some cloud providers require a config file. If so, you need to put config file into apiserver image or mount through hostPath.
683672
684- # ## Scheduler
673+ - ` --cloud-config=` set if cloud provider requires a config file.
674+ - Used by `aws`, `gce`, `mesos`, `openshift`, `ovirt` and `rackspace`.
675+ - You must put config file into apiserver image or mount through hostPath.
676+ - Cloud config file syntax is [Gcfg](https://code.google.com/p/gcfg/).
677+ - AWS format defined by type [AWSCloudConfig](../../pkg/cloudprovider/aws/aws.go)
678+ - There is a similar type in the corresponding file for other cloud providers.
679+ - GCE example : search for `gce.conf` in [this file](../../cluster/gce/configure-vm.sh)
680+
681+ # ### Scheduler pod template
685682
686683Complete this template for the scheduler pod :
687684
688685` ` ` json
686+
689687{
690688 "kind": "Pod",
691689 "apiVersion": "v1",
@@ -701,7 +699,7 @@ Complete this template for the scheduler pod:
701699 "command": [
702700 "/bin/sh",
703701 "-c",
704- "/usr/local/bin/kube-scheduler --master=127.0.0.1:8080"
702+ "/usr/local/bin/kube-scheduler --master=127.0.0.1:8080 $SCHEDULER_FLAGS "
705703 ],
706704 "livenessProbe": {
707705 "httpGet": {
@@ -715,32 +713,19 @@ Complete this template for the scheduler pod:
715713 ]
716714 }
717715}
718- ` ` `
719716
720- Optionally, you may want to mount `/var/log` as well and redirect output there.
717+ ` ` `
721718
722- Start as described for apiserver .
719+ Typically, no additional flags are required for the scheduler .
723720
724- # ## Controller Manager
721+ Optionally, you may want to mount `/var/log` as well and redirect output there.
725722
726- To run the controller manager :
727- - select the correct flags for your cluster
728- - write a pod spec for the controller manager using the provided template
729- - start the controller manager pod
730-
731- Flags to consider using with controller manager.
732- - ` --cluster-name=$CLUSTER_NAME`
733- - ` --cluster-cidr=`
734- - *TODO*: explain this flag.
735- - ` --allocate-node-cidrs=`
736- - *TODO*: explain when you want controller to do this and when you wanna do it another way.
737- - ` --cloud-provider=` and `--cloud-config` as described in apiserver section.
738- - ` --service-account-private-key-file=/srv/kubernetes/server.key` , used by [service account](../user-guide/service-accounts.md) feature.
739- - ` --master=127.0.0.1:8080`
723+ # ### Controller Manager Template
740724
741725Template for controller manager pod :
742726
743727` ` ` json
728+
744729{
745730 "kind": "Pod",
746731 "apiVersion": "v1",
@@ -756,7 +741,7 @@ Template for controller manager pod:
756741 "command": [
757742 "/bin/sh",
758743 "-c",
759- "/usr/local/bin/kube-controller-manager $ARGS "
744+ "/usr/local/bin/kube-controller-manager $CNTRLMNGR_FLAGS "
760745 ],
761746 "volumeMounts": [
762747 {
@@ -796,8 +781,49 @@ Template for controller manager pod:
796781 ]
797782 }
798783}
784+
799785` ` `
800786
787+ Flags to consider using with controller manager :
788+ - ` --cluster-name=$CLUSTER_NAME`
789+ - ` --cluster-cidr=`
790+ - *TODO*: explain this flag.
791+ - ` --allocate-node-cidrs=`
792+ - *TODO*: explain when you want controller to do this and when you want to do it another way.
793+ - ` --cloud-provider=` and `--cloud-config` as described in apiserver section.
794+ - ` --service-account-private-key-file=/srv/kubernetes/server.key` , used by the [service account](../user-guide/service-accounts.md) feature.
795+ - ` --master=127.0.0.1:8080`
796+
797+ # ### Starting and Verifying Apiserver, Scheduler, and Controller Manager
798+
799+ Place each completed pod template into the kubelet config dir
800+ (whatever `--config=` argument of kubelet is set to, typically
801+ `/etc/kubernetes/manifests`). The order does not matter : scheduler and
802+ controller manager will retry reaching the apiserver until it is up.
803+
804+ Use `ps` or `docker ps` to verify that each process has started. For example, verify that kubelet has started a container for the apiserver like this :
805+
806+ ` ` ` console
807+ $ sudo docker ps | grep apiserver:
808+ 5783290746d5 gcr.io/google_containers/kube-apiserver:e36bf367342b5a80d7467fd7611ad873 "/bin/sh -c '/usr/lo'" 10 seconds ago Up 9 seconds k8s_kube-apiserver.feb145e7_kube-apiserver-kubernetes-master_default_eaebc600cf80dae59902b44225f2fc0a_225a4695
809+ ` ` `
810+
811+ Then try to connect to the apiserver :
812+
813+ ` ` ` console
814+ $ echo $(curl -s http://localhost:8080/healthz)
815+ ok
816+ $ curl -s http://localhost:8080/api
817+ {
818+ "versions": [
819+ "v1"
820+ ]
821+ }
822+ ` ` `
823+
824+ If you have selected the `--register-node=true` option for kubelets, they will now begin self-registering with the apiserver.
825+ You should soon be able to see all your nodes by running the `kubect get nodes` command.
826+ Otherwise, you will need to manually create node objects.
801827
802828# ## Logging
803829
0 commit comments