https://github.com/debianmaster/k8s-custom-controller
Simple k8s and openshift customer controller
https://github.com/debianmaster/k8s-custom-controller
Last synced: 11 months ago
JSON representation
Simple k8s and openshift customer controller
- Host: GitHub
- URL: https://github.com/debianmaster/k8s-custom-controller
- Owner: debianmaster
- Created: 2017-05-23T04:24:46.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-20T16:44:30.000Z (about 8 years ago)
- Last Synced: 2025-07-05T00:06:03.370Z (12 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> This is based on official example https://github.com/kubernetes/kubernetes/tree/master/staging/src/k8s.io/client-go/examples/in-cluster but i'm listing down the steps here to make it easy for beginners.
## k8s / openshift simple custom controller
```sh
cd $GOPATH
git clone https://github.com/debianmaster/k8s-custom-controller
cd k8s-custom-controller
go get k8s.io/client-go/kubernetes
go get k8s.io/apimachinery/pkg/apis/meta/v1
mkdir -p bin/linux
GOOS=linux GOARCH=amd64 go build -o bin/linux/custom-controller .
docker build -t "yournamespace/custom-controller" .
docker push yournamespace/custom-controller
```
### Running in openshift
```sh
oc new-project test1
oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccounts:test1
oc new-app docker.io/yournamespace/custom-controller
```
### Running in kubernetes
```sh
kubectl create namespace t2
kubectl run --image=docker.io/yournamespace/custom-controller custom-controller
```
> look at controller log