Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel5
minLevel5

...

SSH to master node

Navigate to the cloned repository directory <SETUP_HOME> and run the following command:

     vagrant ssh master

...

SSH to minion-1 node

Navigate to the cloned repository directory  <SETUP_HOME> and run the following command:

     vagrant ssh minion-1

...

SSH to minion-2 node

Navigate to the cloned repository directory <SETUP_HOME> and run the following command:

     vagrant ssh minion-2

...

List all the machines in CoreOS cluster

ssh to the master node

     fleetctl list-machines

...

Code Block
core@master ~ $ fleetctl list-machines
MACHINE     IP      METADATA
07215782... 172.17.8.100    -
4b56425a... 172.17.8.102    -
bf39a4c4... 172.17.8.101    -

...

List the available replication controllers

ssh to master node

     kubectl list /replicationControllers

...

Code Block
core@master ~ $ kubectl list /replicationControllers
ID                  Image(s)                           Selector         Replicas
test2.php.domain    54.254.64.141:5000/stratos-php     name=php         2

...

List the available pods

ssh to master node

     kubectl list /pods

...

Code Block
core@master ~ $ kubectl list /pods
ID                                     Image(s)     Host                Labels                               Status
115bbe15-49ff-11e4-91b7-08002794b041   stratos-php  172.17.8.100/       name=php,replicationController=php   Waiting
115cc7e9-49ff-11e4-91b7-08002794b041   stratos-php  172.17.8.101/       name=php,replicationController=php   Waiting

...

Tail the Kubernetes log

ssh to master node

     journalctl -f

...

Restart the Kubernetes scheduler

ssh to master node

     systemctl restart scheduler

...

List all the Docker containers in a node

ssh to the node

     docker ps

The following is a sample of the output that will appear:

Code Block
core@master ~ $ docker ps
CONTAINER ID        IMAGE                        COMMAND                CREATED             STATUS   PORTS
37e3303eb337        stratos-php:latest           "/bin/sh -c '/usr/lo   2 minutes ago       Up                
a3f787d0a7ae        kubernetes/pause:latest      "/pause"               2 minutes ago       Up       0.0.0.0:80->80/tcp

Get the IP address of a Docker container

ssh to the node

     docker inspect CONTAINER-ID | grep IPAddress

...

Code Block
core@master ~ $ docker inspect a3f787d0a7ae | grep IPAddress
IPAddress": "10.100.56.3",

...

SSH to a Docker container
  1. ssh to the node
    ssh root@CONTAINER-IPAddress
  2. enter g as the password

...

Kill a Docker container

ssh to the node

    docker kill CONTAINER-ID

...

Another container will be created within a few seconds.

...

Get info of a specific replicationController as a JSON

ssh to the master node

     kubectl -json get /replicationControllers/REPLICATION-CONTROLLER-ID

...

Code Block
core@master ~ $  kubectl -json get /replicationControllers/test2.php.domain
{"kind":"ReplicationController","id":"test2.php.domain","creationTimestamp":"2014-10-02T07:44:58Z","resourceVersion":6701,"apiVersion":"v1beta1","desiredState":{"replicas":2,"replicaSelector":{"name":"test2.php.domain"},"podTemplate":{"desiredState":{"manifest":{"version":"v1beta1","id":"","volumes":null,"containers":[{"name":"test2-apachestratos-org","image":"54.254.64.141:5000/stratos-php","ports":[{"name":"tcp80","hostPort":80,"containerPort":80,"protocol":"tcp"}],"env":[{"name":"SERVICE_NAME","key":"SERVICE_NAME","value":"php"},{"name":"HOST_NAME","key":"HOST_NAME","value":"test2.apachestratos.org"},{"name":"MULTITENANT","key":"MULTITENANT","value":"false"},{"name":"TENANT_ID","key":"TENANT_ID","value":"-1234"},{"name":"TENANT_RANGE","key":"TENANT_RANGE","value":"-1234"},{"name":"CARTRIDGE_ALIAS","key":"CARTRIDGE_ALIAS","value":"test2"},{"name":"CLUSTER_ID","key":"CLUSTER_ID","value":"test2.php.domain"},{"name":"CARTRIDGE_KEY","key":"CARTRIDGE_KEY","value":"uLBSXhS3Kzos5xVe"},{"name":"REPO_URL","key":"REPO_URL","value":"null"},{"name":"PORTS","key":"PORTS","value":"80"},{"name":"PROVIDER","key":"PROVIDER","value":"apache"},{"name":"PUPPET_IP","key":"PUPPET_IP","value":"127.0.0.1"},{"name":"PUPPET_HOSTNAME","key":"PUPPET_HOSTNAME","value":"puppet.raj.org"},{"name":"PUPPET_DNS_AVAILABLE","key":"PUPPET_DNS_AVAILABLE","value":"null"},{"name":"PUPPET_ENV","key":"PUPPET_ENV","value":"stratos"},{"name":"DEPLOYMENT","key":"DEPLOYMENT","value":"default"},{"name":"CEP_PORT","key":"CEP_PORT","value":"7611"},{"name":"COMMIT_ENABLED","key":"COMMIT_ENABLED","value":"false"},{"name":"MB_PORT","key":"MB_PORT","value":"1883"},{"name":"MB_IP","key":"MB_IP","value":"172.17.42.1"},{"name":"CEP_IP","key":"CEP_IP","value":"172.17.42.1"},{"name":"MEMBER_ID","key":"MEMBER_ID","value":"test2.php.domaindb8e4a24-17e8-40a2-ad85-e0d0ca127887"},{"name":"LB_CLUSTER_ID","key":"LB_CLUSTER_ID"},{"name":"NETWORK_PARTITION_ID","key":"NETWORK_PARTITION_ID"},{"name":"KUBERNETES_CLUSTER_ID","key":"KUBERNETES_CLUSTER_ID","value":"KubGrp1"},{"name":"KUBERNETES_MASTER_IP","key":"KUBERNETES_MASTER_IP","value":"127.0.0.1"},{"name":"KUBERNETES_PORT_RANGE","key":"KUBERNETES_PORT_RANGE","value":"4000-5000"}]}],"restartPolicy":{"always":{}}}},"labels":{"name":"test2.php.domain"}}},"currentState":{"replicas":2,"podTemplate":{"desiredState":{"manifest":{"version":"","id":"","volumes":null,"containers":null,"restartPolicy":{}}}}},"labels":{"name":"test2.php.domain"}}

...

Update a specific replicationController
  1. ssh to the master node

  2. Get the replication controller info as a json as above and save it to a file
    kubectl -json get /replicationControllers/REPLICATION-CONTROLLER-ID >> rep-controller.json
     
  3. Edit the rep-controller.json (for example, set replicas to 0)
  4. Update the replicationController.

...

This will delete all the pods immediately.

...

Delete a pod
  1. ssh to the master node
  2. get the pod ID using kubectl list /pods

...

Code Block
core@master ~ $ kubectl delete pods/3ed5c5a6-4a0a-11e4-91b7-08002794b041
I1002 08:01:25.351501 02112 request.go:292] Waiting for completion of /operations/67
Status
success

...

Delete a replicationController
  1. ssh to the master node
  2. Get the replicationController ID using kubectl list /replicationControllers

...

If you unsubscribe from the cartridge, the replicationControllers, pods and containers for that service cluster will be wiped out. 

...

Destroy a Kubernetes cluster
  1. Navigate to the folder that has the Kubernetes setup.
    For example:

    Code Block
    cd kubernetes-vagrant-setup

     

  2. Destroy the cluster.

    Code Block
    vagrant destroy -f

     

  3. Remove the Vagrant file.

    Code Block
    rm -rf .vagrant/

     

...

Check the CoreOS version

Execute the following command to check the CoreOS version being used for the Kubernetes cluster:

...