Running Kubernetes on Photon OS


  • You need two or more machines with the 1.0 general availability or later version of Photon OS installed.


This document gets you started using Kubernetes with Photon OS. The instructions present a manual configuration that gets one worker node running to help you understand the underlying packages, services, ports, and so forth.

The Kubernetes package provides several services: kube-apiserver, kube-scheduler, kube-controller-manager, kubelet, kube-proxy. These services are managed by systemd. Their configuration resides in a central location: /etc/kubernetes.

The following instructions break the services up between the hosts. The first host, photon-master, will be the Kubernetes master. This host will run the kube-apiserver, kube-controller-manager, and kube-scheduler. In addition, the master will also run etcd. Although etcd is not needed on the master if etcd runs on a different host, this guide assumes that etcd and the Kubernetes master run on the same host. The remaining host, photon-node, will be the node; it will run kubelet, proxy, and docker.

System Information


photon-master =
photon-node =

Prepare the hosts

The following packages should already be installed on the full version of Photon OS, but you might have to install them on the minimal version of Photon OS. If the tdnf command returns "Nothing to do," the package is already installed.

  • Install Kubernetes on all hosts--both photon-master and photon-node.
tdnf install kubernetes
  • Install iptables on photon-master and photon-node:
tdnf install iptables
  • Open the tcp port 8080 (api service) on the photon-master in the firewall
iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
  • Open the tcp port 10250 (api service) on the photon-node in the firewall
iptables -A INPUT -p tcp --dport 10250 -j ACCEPT
  • Install Docker on photon-node:
tdnf install docker
  • Add master and node to /etc/hosts on all machines (not needed if the hostnames are already in DNS). Make sure that communication works between photon-master and photon-node by using a utility such as ping.
echo "    photon-master    photon-node" >> /etc/hosts
  • Edit /etc/kubernetes/config, which will be the same on all the hosts (master and node), so that it contains the following lines:
# Comma separated list of nodes in the etcd cluster

# logging to stderr routes it to the systemd journal

# journal message level, 0 is debug

# Should this cluster be allowed to run privileged docker containers

Configure the Kubernetes services on the master

  • Edit /etc/kubernetes/apiserver to appear as such. The service_cluster_ip_range IP addresses must be an unused block of addresses, not used anywhere else. They do not need to be routed or assigned to anything.
# The address on the local server to listen to.

# Comma separated list of nodes in the etcd cluster

# Address range to use for services

# Add your own
  • Start the appropriate services on master:
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do
    systemctl restart $SERVICES
    systemctl enable $SERVICES
    systemctl status $SERVICES
  • To add the other node, create the following node.json file on the Kubernetes master node:
    "apiVersion": "v1",
    "kind": "Node",
    "metadata": {
        "name": "photon-node",
        "labels":{ "name": "photon-node-label"}
    "spec": {
        "externalID": "photon-node"
  • Now create a node object internally in your Kubernetes cluster by running the following command:
$ kubectl create -f ./node.json

$ kubectl get nodes
NAME                LABELS              STATUS
photon-node         name=photon-node-label     Unknown

Please note that in the above example, it only creates a representation for the node photon-node internally. It does not provision the actual photon-node. Also, it is assumed that photon-node (as specified in name) can be resolved and is reachable from the Kubernetes master node. How to provision a Kubernetes node (photon-node) is shown in a later section.

Configure the Kubernetes services on the node

You configure the kubelet on the node as follows.

  • Edit /etc/kubernetes/kubelet to appear like this:
# Kubernetes kubelet (node) config

# The address for the info server to serve on (set to or "" for all interfaces)

# You may leave this blank to use the actual hostname

# location of the api-server

# Add your own
  • Start the appropriate services on the node (photon-node):
for SERVICES in kube-proxy kubelet docker; do 
    systemctl restart $SERVICES
    systemctl enable $SERVICES
    systemctl status $SERVICES 
  • Check to make sure that the cluster can now see the photon-node on photon-master and that its status changes to Ready.
kubectl get nodes
NAME                LABELS              STATUS
photon-node          name=photon-node-label     Ready

If the node status is NotReady, verify that the firewall rules are permissive for Kubernetes.

  • Deletion of nodes: To delete photon-node from your Kubernetes cluster, one should run the following on photon-master (please do not do it, it is just for information):
kubectl delete -f ./node.json

That's it. You should have a functional cluster. You can now launch a test pod. Check out Kubernetes 101 for an introduction to working with Kubernetes.

results matching ""

    No results matching ""