https://github.com/flavio/salt-kubernetes-demo
Demo of kubernetes-salt integration
https://github.com/flavio/salt-kubernetes-demo
kubernetes salt saltstack
Last synced: 5 months ago
JSON representation
Demo of kubernetes-salt integration
- Host: GitHub
- URL: https://github.com/flavio/salt-kubernetes-demo
- Owner: flavio
- License: apache-2.0
- Created: 2017-02-20T16:22:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-10T06:57:00.000Z (about 8 years ago)
- Last Synced: 2025-03-31T12:05:00.130Z (6 months ago)
- Topics: kubernetes, salt, saltstack
- Language: Python
- Size: 14.6 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is a demo playground of the salt-kubernetes module.
## Requirements
### Getting the Kubernetes up and running
Download k8s all-in-one libvirt machine from [here](https://filr.attachmategroup.com/ssf/s/readFile/share/88236/4263111497095896051/publicLink/kubernetes-101.qcow2.xz).
This is a openSUSE VM that has all the kubernetes bits and pieces already
configured.Right now it's not possible to use minikube images because they don't have python
installed. I'm currently working on a minikube image based on openSUSE that
has all the required pieces.Once you download the image extract it to a storage location known by your libvirtd
daemon and edit the `kubernetes.xml` file shipped inside of this repo by putting
the location of the VM into the `FIXME` field.Then execute the following command:
```
sudo virsh define kubernetes.xml
sudo virsh start kubernetes
```The VMs credentials are:
* username `root`: password `linux`
* username `geeko`: password `linux`### Install Kubernetes python client
The Kubernetes salt module relies on the
[official python client](https://github.com/kubernetes-incubator/client-python)
to be installed inside of the VM.You can do that by ssh-ing into the machine and then doing:
```
sudo zypper in python-pip
sudo pip install kubernetes
```### Checkout the kubernetes module (optional)
Right now the code defining the kubernetes modules lives inside of
[this public repository](https://github.com/flavio/salt/tree/kubernetes-modules)For convenience reasons this repository has a copy of the kubernetes
module and state files. These files are going to be **out of sync** with the
contents of the original PR.You can clone the repository holding the official source code of the kubernetes
module and then replace the following files with hard links:* `srv/salt/_modules/kubernetes.py`
* `srv/salt/_states/kubernetes.py`### Configure salt-ssh
Make sure `salt-ssh` is installed on your host.
Once the VM is up and running you can obtain its IP address by doing:
```
sudo virsh domifaddr kubernetes
```Then edit the `etc/salt/roster` file shipped inside of this repo and put
the right IP address of the kubernetes VM inside of it.Now you can test everything is working properly by doing:
```
$ salt-ssh 'kubernetes' kubernetes.ping
kubernetes:
True
```## Playing with Kubernetes
### Managing deployments
This salt module can be used to create kubernetes deployments:
[](https://asciinema.org/a/103881)
or to remove them:
[](https://asciinema.org/a/103881)
### Managing deployments and services
It's also possible to deploy the complete [guestbook 101 application](https://github.com/kubernetes/kubernetes/tree/master/examples/guestbook) using salt:
Deploying the full stack:
[](https://asciinema.org/a/103883)
Removing the entire stack:
[](https://asciinema.org/a/103884)