text stringlengths 0 59.1k |
|---|
You can automate the process with the following script, as it might take more than a minute for the IP to be set and discoverable. |
```shell |
$ while [ ${#PUBLIC_OPENSHIFT_IP} -lt 1 ]; do |
echo -n . |
sleep 1 |
{ |
export PUBLIC_OPENSHIFT_IP=$(kubectl get services openshift --namespace="openshift-origin" --template="{{ index .status.loadBalancer.ingress 0 \"ip\" }}") |
} 2> ${OPENSHIFT_EXAMPLE}/openshift-startup.log |
if [[ ! ${PUBLIC_OPENSHIFT_IP} =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then |
export PUBLIC_OPENSHIFT_IP="" |
fi |
done |
$ echo |
$ echo "Public OpenShift IP set to: ${PUBLIC_OPENSHIFT_IP}" |
``` |
Ensure you have a valid PUBLIC_IP address before continuing in the example. |
We now need to run a command on your host to generate a proper OpenShift configuration. To do this, we will volume mount the configuration directory that holds your Kubernetes kubeconfig file from the prior step. |
```sh |
$ docker run --privileged -v ${OPENSHIFT_CONFIG}:/config openshift/origin start master --write-config=/config --kubeconfig=/config/kubeconfig --master=https://localhost:8443 --public-master=https://${PUBLIC_OPENSHIFT_IP}:8443 --etcd=http://etcd:2379 |
``` |
You should now see a number of certificates minted in your configuration directory, as well as a master-config.yaml file that tells the OpenShift master how to execute. We need to make some adjustments to this configuration directory in order to allow the OpenShift cluster to use Kubernetes serviceaccounts. First, wri... |
```shell |
$ export ZONE=$(gcloud compute instances list | grep "${KUBE_GCE_INSTANCE_PREFIX}\-master" | awk '{print $2}' | head -1) |
$ echo "sudo cat /srv/kubernetes/server.key; exit;" | gcloud compute ssh ${KUBE_GCE_INSTANCE_PREFIX}-master --zone ${ZONE} | grep -Ex "(^\-.*\-$|^\S+$)" > ${OPENSHIFT_CONFIG}/serviceaccounts.private.key |
``` |
Although we are retrieving the private key from the Kubernetes master, OpenShift will take care of the conversion for us so that serviceaccounts are created with the public key. Edit your `master-config.yaml` file in the `${OPENSHIFT_CONFIG}` directory to add `serviceaccounts.private.key` to the list of `publicKeyFiles... |
```shell |
$ sed -i -e 's/publicKeyFiles:.*$/publicKeyFiles:/g' -e '/publicKeyFiles:/a \ \ - serviceaccounts.private.key' ${OPENSHIFT_CONFIG}/master-config.yaml |
``` |
Now, the configuration files are complete. In the next step, we will bundle the resulting configuration into a Kubernetes Secret that our OpenShift master pod will consume. |
### Step 4: Bundle the configuration into a Secret |
We now need to bundle the contents of our configuration into a secret for use by our OpenShift master pod. |
OpenShift includes an experimental command to make this easier. |
First, update the ownership for the files previously generated: |
``` |
$ sudo -E chown -R ${USER} ${OPENSHIFT_CONFIG} |
``` |
Then run the following command to collapse them into a Kubernetes secret. |
```sh |
$ docker run -it --privileged -e="KUBECONFIG=/config/admin.kubeconfig" -v ${OPENSHIFT_CONFIG}:/config openshift/origin cli secrets new openshift-config /config -o json &> examples/openshift-origin/secret.json |
``` |
Now, lets create the secret in your Kubernetes cluster. |
```sh |
$ cluster/kubectl.sh create -f examples/openshift-origin/secret.json --namespace="openshift-origin" |
``` |
**NOTE: This secret is secret and should not be shared with untrusted parties.** |
### Step 5: Deploy OpenShift Master |
We are now ready to deploy OpenShift. |
We will deploy a pod that runs the OpenShift master. The OpenShift master will delegate to the underlying Kubernetes |
system to manage Kubernetes specific resources. For the sake of simplicity, the OpenShift master will run with an embedded etcd to hold OpenShift specific content. This demonstration will evolve in the future to show how to run etcd in a pod so that content is not destroyed if the OpenShift master fails. |
```sh |
$ cluster/kubectl.sh create -f ${OPENSHIFT_EXAMPLE}/openshift-controller.yaml --namespace="openshift-origin" |
``` |
You should now get a pod provisioned whose name begins with openshift. |
```sh |
$ cluster/kubectl.sh get pods | grep openshift |
$ cluster/kubectl.sh log openshift-t7147 origin |
Running: cluster/../cluster/gce/../../cluster/../_output/dockerized/bin/linux/amd64/kubectl logs openshift-t7t47 origin |
2015-04-30T15:26:00.454146869Z I0430 15:26:00.454005 1 start_master.go:296] Starting an OpenShift master, reachable at 0.0.0.0:8443 (etcd: [https://10.0.27.2:4001]) |
2015-04-30T15:26:00.454231211Z I0430 15:26:00.454223 1 start_master.go:297] OpenShift master public address is https://104.197.73.241:8443 |
``` |
Depending upon your cloud provider, you may need to open up an external firewall rule for tcp:8443. For GCE, you can run the following: |
```sh |
$ gcloud compute --project "your-project" firewall-rules create "origin" --allow tcp:8443 --network "your-network" --source-ranges "0.0.0.0/0" |
``` |
Consult your cloud provider's documentation for more information. |
Open a browser and visit the OpenShift master public address reported in your log. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.