c12s-kubespray/README.md

126 lines
2.2 KiB
Markdown
Raw Normal View History

2016-06-16 10:36:58 +00:00
vagrant-k8s
===========
Scripts to create libvirt lab with vagrant and prepare some stuff for `k8s` deployment with `kargo`.
Requirements
============
2016-06-16 15:50:44 +00:00
* `libvirt`
* `vagrant`
2016-06-20 14:12:18 +00:00
* `vagrant-libvirt` plugin (`vagrant plugin install vagrant-libvirt`)
2016-06-16 15:50:44 +00:00
* `$USER` should be able to connect to libvirt (test with `virsh list --all`)
2016-06-16 10:36:58 +00:00
How-to
======
Vargant lab preparation
-----------------------
2016-06-20 14:12:18 +00:00
* Change default IP pool for vagrant networks if you want:
2016-06-16 10:36:58 +00:00
```bash
export VAGRANT_POOL="10.100.0.0/16"
2016-06-20 14:12:18 +00:00
```
2016-06-30 13:47:28 +00:00
* Clone this repo
```bash
git clone https://github.com/adidenko/vagrant-k8s
cd vagrant-k8s
```
* If you want to run OpenStack CCP (Containerised Control Plane) then you need
to pull CCP repos and patches:
2016-06-27 15:57:29 +00:00
```bash
pushd ccp
./ccp-pull.sh
popd
```
2016-06-20 14:12:18 +00:00
* Prepare the virtual lab:
```bash
2016-06-16 10:36:58 +00:00
vagrant up
```
Deployment on a lab
-------------------
* Login to master node and sudo to root:
2016-06-16 10:36:58 +00:00
```bash
vagrant ssh $USER-k8s-01
sudo su -
```
* Clone this repo
```bash
git clone https://github.com/adidenko/vagrant-k8s ~/mcp
```
* Install required software and pull needed repos (modify script if you're not
running it on Vagrant lab, you'll need to create `nodes` list manually and
clone `microservices` and `microservices-repos` repositories, see ccp-pull.sh
for details)
```bash
cd ~/mcp
./bootstrap-master.sh
```
* Check nodes list and make sure you have SSH access to them
```bash
cd ~/mcp
cat nodes
```
* Deploy k8s using kargo playbooks
```bash
cd ~/mcp
2016-06-16 10:36:58 +00:00
./deploy-k8s.kargo.sh
```
2016-06-27 15:57:29 +00:00
* Deploy OpenStack CCP:
2016-06-27 15:57:29 +00:00
```bash
cd ~/mcp
2016-06-27 15:57:29 +00:00
./deploy-ccp.sh
```
2016-06-30 15:19:21 +00:00
Working with kubernetes
-----------------------
2016-06-30 15:16:33 +00:00
* Login to one of your kube-master nodes (see `/root/kargo/inventory/inventory.cfg`
on master node) and run:
```bash
# List images in registry
curl -s 127.0.0.1:31500/v2/_catalog | python -mjson.tool
# Check CCP jobs status
kubectl --namespace=openstack get jobs
# Check CCP pods
kubectl --namespace=openstack get pods -o wide
```
* Troubleshooting
```bash
# Get logs from pod
kubectl --namespace=openstack logs $POD_NAME
# Exec command from pod
kubectl --namespace=openstack exec $POD_NAME cat /etc/resolv.conf
kubectl --namespace=openstack exec $POD_NAME curl http://etcd-client:2379/health
# Run a container
docker run -t -i 127.0.0.1:31500/mcp/neutron-dhcp-agent /bin/bash
```