helm packaging

This commit is contained in:
Pamir Erdem
2018-12-04 02:43:54 +03:00
parent f1b696a1ee
commit 9238e5c9cf
10 changed files with 166 additions and 12 deletions

View File

@@ -10,4 +10,4 @@ spec:
image: nginx
imagePullPolicy: IfNotPresent
nodeSelector:
cpu: mukemmel
cpu: kotu

View File

@@ -0,0 +1,26 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-test
spec:
replicas: 5
selector:
matchLabels:
service: http-server
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 50%
maxUnavailable: 1
minReadySeconds: 5
template:
metadata:
labels:
service: http-server
spec:
containers:
- name: nginx
image: nginx:1.7.9
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80

View File

@@ -0,0 +1,5 @@
```bash
#cluster-info
gcloud container clusters describe meetup --project=inspired-bus-194216 --zone=us-central1-c --format="json" | grep service
gcloud container clusters describe meetup --project=inspired-bus-194216 --zone=us-central1-c --format="json" | grep Ip
```

View File

@@ -0,0 +1,20 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: web-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- http:
paths:
- path: /v2/*
backend:
serviceName: web-v2
servicePort: 8080
- path: /v1/*
backend:
serviceName: web-v1
servicePort: 8080
tls:
- secretName: web-tls

View File

@@ -3,8 +3,6 @@ kind: Service
metadata:
creationTimestamp: null
labels:
internalVersion: 0.0.1
name: kuard
run: kuard
name: kuard
spec:
@@ -14,7 +12,6 @@ spec:
targetPort: 8080
selector:
internalVersion: 0.0.1
name: kuard
run: kuard
type: LoadBalancer
status:

View File

@@ -3,8 +3,6 @@ kind: Service
metadata:
creationTimestamp: null
labels:
internalVersion: 0.0.1
name: kuard
run: kuard
name: kuard
spec:
@@ -14,7 +12,6 @@ spec:
targetPort: 8080
selector:
internalVersion: 0.0.1
name: kuard
run: kuard
type: NodePort
status:

View File

@@ -3,8 +3,6 @@ kind: Service
metadata:
creationTimestamp: null
labels:
internalVersion: 0.0.1
name: kuard
run: kuard
name: kuard
spec:
@@ -14,8 +12,7 @@ spec:
targetPort: 8080
selector:
internalVersion: 0.0.1
name: kuard
run: kuard
type: ClusterIP
type: NodePort
status:
loadBalancer: {}

View File

@@ -7,7 +7,7 @@ spec:
storage: 10Gi
accessModes:
- ReadWriteOnce
gcePersistnetDisk:
gcePersistentDisk:
pdName: meetup-disk
fsType: ext4

27
09-crd/01-crd.yaml Normal file
View File

@@ -0,0 +1,27 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: crontabs.stable.example.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: stable.example.com
# list of versions supported by this CustomResourceDefinition
versions:
- name: v1
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: crontabs
# singular name to be used as an alias on the CLI and for display
singular: crontab
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: CronTab
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- ct

View File

@@ -0,0 +1,85 @@
#### Installation
```bash
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller --upgrade
kubectl get deployment -n kube-system -o yaml tiller-deploy | grep serviceAccount
```
#### Helm uninstall from cluster
```bash
helm reset
kubectl get pods -n kube-system
```
#### Forget to create service account
```bash
#https://github.com/fnproject/fn-helm/issues/21
helm init
helm list
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm --help
helm list --help
helm list
helm list -a
```
#### Stable Charts && Incubator Charts
```bash
helm search mysql
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
helm search cassandra
curl -XGET https://kubernetes-charts-incubator.storage.googleapis.com/
```
open from Chrome https://console.cloud.google.com/storage/browser/kubernetes-charts-incubator </br>
```bash
helm install stable/nginx-ingress --name nginx-ing --namespace app
kubectl get all -n app
helm list
helm delete --help
helm delete nginx-ing --purge
```
### Managing dependencies
```bash
mkdir -p $HOME/dev/tools_data
cd ~/dev/tools_data
git clonehttps://github.com/helm/charts.git
cd charts/stable
cd sonarqube
cat requirements.yaml
mkdir charts/postgresql
cp -R ../postgresql charts/postgresql
helm install . --name sonarqube --namespace app -f values.yaml
helm list
```
#### Helm Commands
```bash
helm status sonarqube
helm inspect .
helm inspect stable/mysql
```
change limits in values.yaml </br>
```yaml
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 128Mi
```
```bash
helm upgrade sonarqube . -f values.yaml
helm history sonarqube
helm rollback --dry-run=true sonarqube 1
helm rollback sonarqube 1
kubectl get pods -n app
```