Skip to content

Instantly share code, notes, and snippets.

@thebsdbox
Created December 12, 2018 09:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebsdbox/a2662bbed8bc1f74237f9cc009c16122 to your computer and use it in GitHub Desktop.
Save thebsdbox/a2662bbed8bc1f74237f9cc009c16122 to your computer and use it in GitHub Desktop.
{
"deployments": [
{
"name": "Upload Docker Packages",
"parallel": false,
"sessions": 0,
"hosts": [
"192.168.1.3",
"192.168.1.4",
"192.168.1.5"
],
"actions": [
{
"name": "Upload Docker Packages",
"type": "upload",
"source": "./docker_pkg.tar.gz",
"destination": "/tmp/docker_pkg.tar.gz"
},
{
"name": "Extract Docker packages",
"type": "command",
"command": "tar -C /tmp -xvzf /tmp/docker_pkg.tar.gz"
},
{
"name": "Install Docker packages",
"type": "command",
"command": "dpkg -i /tmp/docker/*",
"commandSudo": "root"
},
{
"name": "Disable Swap",
"type": "command",
"command": "swapoff -a",
"commandSudo": "root"
},
{
"name": "Disable Swap in fstab",
"type": "command",
"command": "sed -i '/swap/d' /etc/fstab",
"commandSudo": "root"
},
{
"name": "Upload Kubernetes Packages",
"type": "upload",
"source": "./kubernetes_pkg.tar.gz",
"destination": "/tmp/kubernetes_pkg.tar.gz"
},
{
"name": "Extract Kubernetes packages",
"type": "command",
"command": "tar -C /tmp -xvzf /tmp/kubernetes_pkg.tar.gz"
},
{
"name": "Install Kubernetes packages",
"type": "command",
"command": "dpkg -i /tmp/kubernetes/*",
"commandSudo": "root"
},
{
"name": "Upload kubectl systemd unit file",
"type": "upload",
"source": "./20-etcd-service-manager.conf",
"destination": "/tmp/20-etcd-service-manager.conf"
},
{
"name": "Move unit file into place",
"type": "command",
"command": "mv /tmp/20-etcd-service-manager.conf /etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf",
"commandSudo": "root"
},
{
"name": "Reload systemd daemon",
"type": "command",
"command": "systemctl daemon-reload",
"commandSudo": "root"
},
{
"name": "Restart Kubelet",
"type": "command",
"command": "systemctl restart kubelet",
"commandSudo": "root"
},
{
"name": "Upload kubernetes images",
"type": "upload",
"source": "./k8s_images.tar",
"destination": "/tmp/k8s_images.tar"
},
{
"name": "Import kubernetes images",
"type": "command",
"command": "docker load --input /tmp/k8s_images.tar",
"commandSudo": "root"
}
]
},
{
"name": "Configure ETCd",
"parallel": false,
"sessions": 0,
"hosts": [
"192.168.1.3"
],
"actions": [
{
"name": "Upload Kubeadm script",
"type": "upload",
"source": "./kubeadmcfg.sh",
"destination": "/tmp/kubeadmcfg.sh"
},
{
"name": "Upload Kubeadm custom configuraton",
"type": "upload",
"source": "./k8s.config",
"destination": "/tmp/k8s.config"
},
{
"name": "Ensuring configuration script is executable",
"type": "command",
"command": "chmod +x /tmp/kubeadmcfg.sh",
"commandSudo": "root"
},
{
"name": "Building Kubernetes certificates",
"type": "command",
"command": "/tmp/kubeadmcfg.sh",
"commandSudo": "root"
},
{
"name": "Download host02 config",
"type": "download",
"source": "/tmp/192.168.1.4-k8s.tar.gz",
"destination": "/tmp/192.168.1.4-k8s.tar.gz"
},
{
"name": "Download host02 config",
"type": "download",
"source": "/tmp/192.168.1.5-k8s.tar.gz",
"destination": "/tmp/192.168.1.5-k8s.tar.gz"
},
{
"name": "Starting first etcd node",
"type": "command",
"command": "kubeadm init phase etcd local --config=/tmp/192.168.1.3/kubeadmcfg.yaml",
"commandSudo": "root"
}
]
},
{
"name": "Configure ETCd node02",
"parallel": false,
"sessions": 0,
"hosts": [
"192.168.1.4"
],
"actions": [
{
"name": "Upload etcd configuration for node02",
"type": "upload",
"source": "/tmp/192.168.1.4-k8s.tar.gz",
"destination": "/tmp/192.168.1.4-k8s.tar.gz"
},
{
"name": "Expanding configuration archive",
"type": "command",
"command": "tar -C / -xvzf /tmp/192.168.1.4-k8s.tar.gz",
"commandSudo": "root"
},
{
"name": "Setting correct ownership of etcd certificates",
"type": "command",
"command": "chown -R root:root /tmp/192.168.1.4/pki",
"commandSudo": "root"
},
{
"name": "Installing certificates",
"type": "command",
"command": "cp -r /tmp/192.168.1.4/pki /etc/kubernetes/",
"commandSudo": "root"
},
{
"name": "Starting second etcd node",
"type": "command",
"command": "kubeadm init phase etcd local --config=/tmp/192.168.1.4/kubeadmcfg.yaml",
"commandSudo": "root"
}
]
},
{
"name": "Configure ETCd node03",
"parallel": false,
"sessions": 0,
"hosts": [
"192.168.1.5"
],
"actions": [
{
"name": "Upload etcd configuration for node02",
"type": "upload",
"source": "/tmp/192.168.1.5-k8s.tar.gz",
"destination": "/tmp/192.168.1.5-k8s.tar.gz"
},
{
"name": "Expanding configuration archive",
"type": "command",
"command": "tar -C / -xvzf /tmp/192.168.1.5-k8s.tar.gz",
"commandSudo": "root"
},
{
"name": "Setting correct ownership of etcd certificates",
"type": "command",
"command": "chown -R root:root /tmp/192.168.1.5/pki",
"commandSudo": "root"
},
{
"name": "Installing certificates",
"type": "command",
"command": "cp -r /tmp/192.168.1.5/pki /etc/kubernetes/",
"commandSudo": "root"
},
{
"name": "Starting second etcd node",
"type": "command",
"command": "kubeadm init phase etcd local --config=/tmp/192.168.1.5/kubeadmcfg.yaml",
"commandSudo": "root"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment