first commit
1
docs/about.md
Normal file
@@ -0,0 +1 @@
|
||||
### What
|
65
docs/docker.md
Normal file
@@ -0,0 +1,65 @@
|
||||
## Docker@RUG
|
||||
|
||||
Vraag een API aan via webhosting.cit@rug.nl voor toegang tot de docker test omgeving.
|
||||
|
||||
|
||||
#Docker run debug
|
||||
```
|
||||
$ docker run --rm -it -p "":80 registry.webhosting.rug.nl/username/name:latest
|
||||
```
|
||||
|
||||
# Download composer :
|
||||
````
|
||||
Linux :
|
||||
https://releases.rancher.com/compose/v0.12.5/rancher-compose-linux-amd64-v0.12.5.tar.gz
|
||||
Windows :
|
||||
https://releases.rancher.com/compose/v0.12.5/rancher-compose-windows-386-v0.12.5.zip
|
||||
Mac OS X :
|
||||
https://releases.rancher.com/compose/v0.12.5/rancher-compose-darwin-amd64-v0.12.5.tar.gz
|
||||
````
|
||||
|
||||
# Download cli :
|
||||
````
|
||||
Linux :
|
||||
https://releases.rancher.com/cli/v0.6.3/rancher-linux-amd64-v0.6.3.tar.gz
|
||||
Windows :
|
||||
https://releases.rancher.com/cli/v0.6.3/rancher-windows-386-v0.6.3.zip
|
||||
Mac OS X :
|
||||
https://releases.rancher.com/cli/v0.6.3/rancher-darwin-amd64-v0.6.3.tar.gz
|
||||
````
|
||||
|
||||
|
||||
#Connect by cli :
|
||||
|
||||
````
|
||||
tar xvzf rancher-linux-amd64-v0.6.3.tar.gz
|
||||
cd rancher-v0.6.3
|
||||
|
||||
./rancher --url https://webhost12.service.rug.nl:8080/v1 --access-key 12345678 --secret-key zeergeheim --env 111 --host dcktest001 docker cmd
|
||||
|
||||
create alias :
|
||||
echo "rcl=~/directory/rancher-v0.6.3/rancher --url https://webhost12.service.rug.nl:8080/v1 --access-key 12345678 --secret-key zeergeheim --env 111" > .bashrc
|
||||
. bashrc
|
||||
|
||||
rcl --host dcktest00{1,2} docker cmd
|
||||
|
||||
````
|
||||
|
||||
## Registry
|
||||
|
||||
<a href="https://registry.webhosting.rug.nl" target="_blank">https://registry.webhosting.rug.nl</a>
|
||||
|
||||
|
||||
login private registry
|
||||
```
|
||||
$ docker login registry.webhosting.rug.nl
|
||||
```
|
||||
|
||||
# Build tag push
|
||||
|
||||
````
|
||||
$ cd docker-build-directory
|
||||
$ docker build -t name .
|
||||
$ docker tag name:latest registry.webhosting.rug.nl/username/name:latest
|
||||
$ docker push registry.webhosting.rug.nl/username/name:latest
|
||||
````
|
45
docs/drone.md
Normal file
@@ -0,0 +1,45 @@
|
||||
### Drone is a Continuous Delivery platform built on Docker
|
||||
|
||||
URL : <a href="https://drone.webhosting.rug.nl" target="_blank">https://drone.webhosting.rug.nl</a>
|
||||
|
||||
|
||||
```
|
||||
login with you're git credentials -> https://git.webhosting.rug.nl
|
||||
|
||||
```
|
||||
|
||||
#### Howto build
|
||||
````
|
||||
choose a repository from GIT
|
||||
Enter the build
|
||||
Go to the menu and add the secrets en registry
|
||||
example :
|
||||
docker_username = test
|
||||
docker_password = secret
|
||||
|
||||
````
|
||||
|
||||
#### example drone.yml
|
||||
````
|
||||
cat > .drone.yml <<EOF
|
||||
pipeline:
|
||||
publish:
|
||||
image: plugins/docker
|
||||
secrets: [ docker_username, docker_password ]
|
||||
registry: registry.webhosting.rug.nl
|
||||
repo: registry.webhosting.rug.nl/webhosting/debian-web5
|
||||
file: Dockerfile
|
||||
tag:
|
||||
- latest
|
||||
notify:
|
||||
image: drillster/drone-email
|
||||
host: mail-server
|
||||
port: 25
|
||||
skip_verify: true
|
||||
from: drone@example.org
|
||||
recipients: [ to@example.org ]
|
||||
recipients_only: true
|
||||
when:
|
||||
status: [ success, changed, failure ]
|
||||
EOF
|
||||
````
|
23
docs/examples.md
Normal file
@@ -0,0 +1,23 @@
|
||||
title: Examples
|
||||
|
||||
# Theme Examples
|
||||
|
||||
This page is full of examples so you can see how this theme renders different
|
||||
aspects of the documentation.
|
||||
|
||||
## Code highlighting
|
||||
|
||||
Here is a Python code block.
|
||||
|
||||
```python
|
||||
a,b = 0,1
|
||||
def fib():
|
||||
global a,b
|
||||
while True:
|
||||
a,b = b, a+b
|
||||
yield a
|
||||
```
|
||||
|
||||
This is an example of inline code: `f = fib()` and `f.next()`.
|
||||
|
||||
You can also use inline code as a link: [`index.md`](index.md)
|
11
docs/git.md
Normal file
@@ -0,0 +1,11 @@
|
||||
#info
|
||||
|
||||
URL <a href="https://git.webhosting.rug.nl" target="_blank">https://git.webhosting.rug.nl</a>
|
||||
|
||||
set environment
|
||||
```
|
||||
$ account@ssh.webhosting.rug.nl
|
||||
$ git config --global user.name "My Username"
|
||||
$ git config --global user.email "email@rug.nl"
|
||||
|
||||
```
|
213
docs/index.md
Normal file
@@ -0,0 +1,213 @@
|
||||
[](https://hub.docker.com/r/pengbai/docker-mkdocs/)
|
||||
|
||||
|
||||
# RUG WEBHOSTING
|
||||
|
||||
* Docker domain hosting
|
||||
* 5+ GB website space ( fair use policy )
|
||||
* PHP support (Linux/Apache variant)
|
||||
* ASP support (Windows/IIS variant)
|
||||
|
||||
The following options are available at an extra charge:
|
||||
|
||||
* expansion of web space (in consultation with CIT)
|
||||
* e-mail addresses
|
||||
* domain registration (.nl, .com, .org, .eu, etc.).
|
||||
|
||||
|
||||
Since 2017 every new hosting domain is automatically a docker environment.
|
||||
There's still a active connection between the old shared environment and the new one.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## HTTPS
|
||||
|
||||
The whole webhosting environment is behind several loadbalancers, force ssl does not work out of the box.
|
||||
Because the internal communication between the loadbalancers (lb) and webservers are plain http.
|
||||
|
||||
If you force a website without the correct headers, the application will stay in a loop and fail.
|
||||
The answer is simple , the webserver doesn't know that the request is secure! only the loadbalancer knows.
|
||||
|
||||
If we do a htaccess override, actually were telling the webserver , redirect once, if the Header HTTP:X-SSL-Enabled is true, don't do anything! otherwise redirect to https.
|
||||
|
||||
### Examples
|
||||
|
||||
standard
|
||||
```
|
||||
client http (80) <-> http (80) -> http (80) -> website (80)
|
||||
```
|
||||
|
||||
or both
|
||||
```
|
||||
client https (443) <--> (443) -> http (80) -> website(80)
|
||||
```
|
||||
|
||||
force https
|
||||
```
|
||||
client http (80) <-> force redirect https (443) -> http (80) -> website (80)
|
||||
```
|
||||
|
||||
htaccess Override
|
||||
```
|
||||
# auto redirect to ssl, only for webhosting.rug.nl domains or with own certificates
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RequestHeader set HTTP:X-SSL-Enabled "true"
|
||||
RewriteCond %{HTTP:X-SSL-Enabled} !true
|
||||
RewriteRule (.*) https://domain.webhosting.rug.nl/$1 [R,L]
|
||||
</IfModule>
|
||||
|
||||
|
||||
```
|
||||
wordpress https
|
||||
```
|
||||
Add the following to the wp-config.php
|
||||
|
||||
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'X-SSL-Enabled') != 'true') {
|
||||
$_SERVER['HTTPS']='on';
|
||||
}
|
||||
|
||||
If you get mixed content warnings, in the default theme.
|
||||
edit the file : wp-content/themes/twentyseventeen/assets/images/svg-icons.svg
|
||||
and replace http to https
|
||||
|
||||
old xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
new xmlns="https://www.w3.org/2000/svg" xmlns:xlink="https://www.w3.org/1999/xlink">
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
## SSH
|
||||
|
||||
SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server.
|
||||
Common applications include remote command-line login and remote command execution, but any network service can be secured with SSH.
|
||||
|
||||
|
||||
Example Connection
|
||||
```
|
||||
ssh f-number@ssh.webhosting.rug.nl
|
||||
```
|
||||
|
||||
Example Tunnel
|
||||
```
|
||||
ssh -L 8080:IP:80 f-number@ssh.webhosting.rug.nl -N 1
|
||||
```
|
||||
|
||||
WEB
|
||||
This only works with Two Factor Authentication
|
||||
```
|
||||
https://ssh.webhosting.rug.nl
|
||||
```
|
||||
|
||||
Two factor auth
|
||||
```
|
||||
Put two files inside you're homedir/.ssh folder
|
||||
mobile_number and email_address
|
||||
|
||||
$ cat ~/.ssh/mobile_number
|
||||
0612345678
|
||||
|
||||
$ cat ~/.ssh/email_address
|
||||
email@rug.nl
|
||||
|
||||
```
|
||||
|
||||
|
||||
Aps
|
||||
```
|
||||
|
||||
filezilla
|
||||
putty
|
||||
wincp
|
||||
ducky
|
||||
ssh
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## MYSQL
|
||||
|
||||
|
||||
|
||||
PHPmyAdmin
|
||||
```
|
||||
https://mysql.webhosting.rug.nl
|
||||
```
|
||||
|
||||
CLI dump database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ mysqldump --host mysql01.service.rug.nl -u account -p -D database \
|
||||
| gzip -c | > ~/backup/database.sql.gz
|
||||
|
||||
```
|
||||
|
||||
CLI restore database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ gunzip < ~/backup/database.sql.gz | mysql --host mysql01.service.rug.nl \
|
||||
-u account -p database > ~/backup/database.sql
|
||||
```
|
||||
|
||||
CLI optimize database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ mysqloptimze --host mysql01.service.rug.nl -u account -p -D database
|
||||
```
|
||||
|
||||
CLI enter database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ mysql --host mysql01.service.rug.nl -u account -p
|
||||
```
|
||||
|
||||
CLI remote access database
|
||||
```
|
||||
$ ssh -L 3306:mysql01.service.rug.nl:3306 account@ssh.webhosting.rug.nl -N 1
|
||||
$ mysql --host localhost -u account -p
|
||||
```
|
||||
|
||||
|
||||
## POSTGRES
|
||||
|
||||
phpPgAdmin
|
||||
|
||||
<a href="https://psql.webhosting.rug.nl" target="_blank">https://psql.webhosting.rug.nl</a>
|
||||
|
||||
|
||||
## PHP
|
||||
|
||||
$ cat ~\site\.htaccess
|
||||
|
||||
Override upload filesize
|
||||
```
|
||||
<IfModule mod_php5.c>
|
||||
php_value upload_max_filesize 100M
|
||||
php_value post_max_size 100M
|
||||
php_value max_execution_time 200
|
||||
php_value max_input_time 200
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
Override memory limit
|
||||
```
|
||||
<IfModule mod_php5.c>
|
||||
php_value memory_limit 64M
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
Access
|
||||
```
|
||||
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
|
||||
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
|
||||
RewriteCond %{REMOTE_ADDR} !^129\.125\.
|
||||
RewriteCond %{REMOTE_ADDR} !^77\.43\.20\.
|
||||
RewriteCond %{REMOTE_ADDR} !^10\.9\.
|
||||
RewriteRule ^(.*)$ - [R=403,L]
|
||||
```
|
||||
|
243
docs/index.md.1
Normal file
@@ -0,0 +1,243 @@
|
||||
[](https://hub.docker.com/r/pengbai/docker-mkdocs/)
|
||||
|
||||
|
||||
# RUG WEBHOSTING
|
||||
|
||||
* Docker domain hosting
|
||||
* 5+ GB website space ( fair use policy )
|
||||
* PHP support (Linux/Apache variant)
|
||||
* ASP support (Windows/IIS variant)
|
||||
|
||||
The following options are available at an extra charge:
|
||||
|
||||
* expansion of web space (in consultation with CIT)
|
||||
* e-mail addresses
|
||||
* domain registration (.nl, .com, .org, .eu, etc.).
|
||||
|
||||
|
||||
Since 2017 every new hosting domain is automatically a docker environment.
|
||||
There's still a active connection between the old shared environment and the new one.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## HTTPS
|
||||
|
||||
The whole webhosting environment is behind several loadbalancers, force ssl does not work out of the box.
|
||||
Because the internal communication between the loadbalancers (lb) and webservers are plain http.
|
||||
|
||||
If you force a website without the correct headers, the application will stay in a loop and fail.
|
||||
The answer is simple , the webserver doesn't know that the request is secure! only the loadbalancer knows.
|
||||
|
||||
If we do a htaccess override, actually were telling the webserver , redirect once, if the Header HTTP:X-SSL-Enabled is true, don't do anything! otherwise redirect to https.
|
||||
|
||||
### Examples
|
||||
|
||||
standard
|
||||
```
|
||||
client http (80) <-> http (80) -> http (80) -> website (80)
|
||||
```
|
||||
|
||||
or both
|
||||
```
|
||||
client https (443) <--> (443) -> http (80) -> website(80)
|
||||
```
|
||||
|
||||
force https
|
||||
```
|
||||
client http (80) <-> force redirect https (443) -> http (80) -> website (80)
|
||||
```
|
||||
|
||||
htaccess Override
|
||||
```
|
||||
# auto redirect to ssl, only for webhosting.rug.nl domains or with own certificates
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RequestHeader set HTTP:X-SSL-Enabled "true"
|
||||
RewriteCond %{HTTP:X-SSL-Enabled} !true
|
||||
RewriteRule (.*) https://domain.webhosting.rug.nl/$1 [R,L]
|
||||
</IfModule>
|
||||
|
||||
|
||||
```
|
||||
wordpress https
|
||||
```
|
||||
Download the plugin simple ssl and enable https
|
||||
Do not force an https override by htaccess!
|
||||
|
||||
```
|
||||
|
||||
|
||||
## SSH
|
||||
|
||||
SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server.
|
||||
Common applications include remote command-line login and remote command execution, but any network service can be secured with SSH.
|
||||
|
||||
|
||||
Example Connection
|
||||
```
|
||||
ssh f-number@ssh.webhosting.rug.nl
|
||||
```
|
||||
|
||||
Example Tunnel
|
||||
```
|
||||
ssh -L 8080:IP:80 f-number@ssh.webhosting.rug.nl -N 1
|
||||
```
|
||||
|
||||
WEB
|
||||
This only works with Two Factor Authentication
|
||||
```
|
||||
https://ssh.webhosting.rug.nl
|
||||
```
|
||||
|
||||
Two factor auth
|
||||
```
|
||||
Put two files inside you're homedir/.ssh folder
|
||||
mobile_number and email_address
|
||||
|
||||
$ cat ~/.ssh/mobile_number
|
||||
0612345678
|
||||
|
||||
$ cat ~/.ssh/email_address
|
||||
email@rug.nl
|
||||
|
||||
```
|
||||
|
||||
|
||||
Aps
|
||||
```
|
||||
|
||||
filezilla
|
||||
putty
|
||||
wincp
|
||||
ducky
|
||||
ssh
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
## MYSQL
|
||||
|
||||
|
||||
|
||||
PHPmyAdmin
|
||||
```
|
||||
https://mysql.webhosting.rug.nl
|
||||
```
|
||||
|
||||
CLI dump database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ mysqldump --host mysql01.service.rug.nl -u account -p -D database \
|
||||
| gzip -c | > ~/backup/database.sql.gz
|
||||
|
||||
```
|
||||
|
||||
CLI restore database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ gunzip < ~/backup/database.sql.gz | mysql --host mysql01.service.rug.nl \
|
||||
-u account -p database > ~/backup/database.sql
|
||||
```
|
||||
|
||||
CLI optimize database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ mysqloptimze --host mysql01.service.rug.nl -u account -p -D database
|
||||
```
|
||||
|
||||
CLI enter database
|
||||
```
|
||||
$ ssh account@ssh.webhosting.rug.nl
|
||||
$ mysql --host mysql01.service.rug.nl -u account -p
|
||||
```
|
||||
|
||||
CLI remote access database
|
||||
```
|
||||
$ ssh -L 3306:mysql01.service.rug.nl:3306 account@ssh.webhosting.rug.nl -N 1
|
||||
$ mysql --host localhost -u account -p
|
||||
```
|
||||
|
||||
|
||||
## POSTGRES
|
||||
|
||||
phpPgAdmin
|
||||
|
||||
<a href="https://psql.webhosting.rug.nl" target="_blank">https://psql.webhosting.rug.nl</a>
|
||||
|
||||
|
||||
## PHP
|
||||
|
||||
$ cat ~\site\.htaccess
|
||||
|
||||
Override upload filesize
|
||||
```
|
||||
<IfModule mod_php5.c>
|
||||
php_value upload_max_filesize 100M
|
||||
php_value post_max_size 100M
|
||||
php_value max_execution_time 200
|
||||
php_value max_input_time 200
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
Override memory limit
|
||||
```
|
||||
<IfModule mod_php5.c>
|
||||
php_value memory_limit 64M
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
Access
|
||||
```
|
||||
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
|
||||
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
|
||||
RewriteCond %{REMOTE_ADDR} !^129\.125\.
|
||||
RewriteCond %{REMOTE_ADDR} !^77\.43\.20\.
|
||||
RewriteCond %{REMOTE_ADDR} !^10\.9\.
|
||||
RewriteRule ^(.*)$ - [R=403,L]
|
||||
```
|
||||
|
||||
|
||||
|
||||
## GIT
|
||||
|
||||
URL
|
||||
|
||||
<a href="https://git.webhosting.rug.nl" target="_blank">https://git.webhosting.rug.nl</a>
|
||||
|
||||
set environment
|
||||
```
|
||||
$ account@ssh.webhosting.rug.nl
|
||||
$ git config --global user.name "My Username"
|
||||
$ git config --global user.email "email@rug.nl"
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
## DOCKER
|
||||
|
||||
REGISTRY URL
|
||||
|
||||
<a href="https://registry.webhosting.rug.nl" target="_blank">https://registry.webhosting.rug.nl</a>
|
||||
|
||||
|
||||
login private registry
|
||||
```
|
||||
$ docker login registry.webhosting.rug.nl
|
||||
```
|
||||
|
||||
create tag push
|
||||
```
|
||||
$ cd docker-build-directory
|
||||
$ docker build -t name .
|
||||
$ docker tag name:latest registry.webhosting.rug.nl/username/name:latest
|
||||
$ docker push registry.webhosting.rug.nl/username/name:latest
|
||||
```
|
||||
|
||||
docker run debug
|
||||
```
|
||||
$ docker run --rm -it -p "":80 registry.webhosting.rug.nl/username/name:latest
|
||||
```
|
443
docs/kubernetes.md
Normal file
@@ -0,0 +1,443 @@
|
||||
# KUBERNETES@RUG
|
||||
|
||||
## Access
|
||||
Vraag een API aan via webhosting.cit@rug.nl voor toegang tot de kubernetes test omgeving.
|
||||
|
||||
````
|
||||
cat > .kube/config <<EOF
|
||||
|
||||
apiVersion: v1
|
||||
kind: Config
|
||||
clusters:
|
||||
- name: "example"
|
||||
cluster:
|
||||
server: "https://example.rug.nl:1234"
|
||||
api-version: v1
|
||||
|
||||
users:
|
||||
- name: "user-test"
|
||||
user:
|
||||
token: "user-example:asdkfljfiwejlakjkdlasdakljdiwqdjiqw&$"
|
||||
|
||||
contexts:
|
||||
- name: "example"
|
||||
context:
|
||||
user: "user-example"
|
||||
cluster: "example"
|
||||
|
||||
current-context: "example"
|
||||
|
||||
EOF
|
||||
````
|
||||
|
||||
## Ingress Controller (edit)
|
||||
|
||||
Steps :
|
||||
|
||||
````
|
||||
kubectl --namespace=<namespace> get ingress
|
||||
kubectl --namespace=<namespace> get ingress | grep <name>
|
||||
|
||||
kubectl edit --namespace=<namespace> ingress <name>
|
||||
|
||||
Adjust some values :
|
||||
|
||||
metadata:
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/proxy-body-size: 10m
|
||||
nginx.ingress.kubernetes.io/proxy-connect-timeout: "120"
|
||||
nginx.ingress.kubernetes.io/proxy-read-timeout: "120"
|
||||
nginx.ingress.kubernetes.io/proxy-send-timeout: "120"
|
||||
|
||||
|
||||
save/quit
|
||||
|
||||
````
|
||||
|
||||
## Ingress WhiteList
|
||||
|
||||
````
|
||||
kubectl edit ingress ....
|
||||
|
||||
# add annotation
|
||||
|
||||
nginx.ingress.kubernetes.io/whitelist-source-range = "1.1.1.1/24"
|
||||
|
||||
|
||||
````
|
||||
|
||||
## Ingress Basic Auth
|
||||
|
||||
````
|
||||
htpasswd -c passfile foo
|
||||
kubectl create secret generic basic-auth --from-file=passfile
|
||||
````
|
||||
|
||||
check secret
|
||||
|
||||
````
|
||||
kubectl get secret basic-auth -o yaml
|
||||
````
|
||||
|
||||
edit ingress
|
||||
````
|
||||
kubectl edit ingress example
|
||||
|
||||
|
||||
metadata:
|
||||
name: ingress-with-auth
|
||||
annotations:
|
||||
# type of authentication
|
||||
nginx.ingress.kubernetes.io/auth-type: basic
|
||||
# name of the secret that contains the user/password definitions
|
||||
nginx.ingress.kubernetes.io/auth-secret: basic-auth
|
||||
# message to display with an appropriate context why the authentication is required
|
||||
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - foo'
|
||||
|
||||
````
|
||||
|
||||
|
||||
## Edit Deployment
|
||||
|
||||
Steps :
|
||||
|
||||
````
|
||||
|
||||
kubectl --namespace=<namespace> get deployments
|
||||
kubectl --namespace=<namespace> get deployment | grep <name>
|
||||
|
||||
kubectl edit --namespace=<namespace> deployments <name>
|
||||
|
||||
Adjust some values :
|
||||
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
- example.com
|
||||
ip: 127.0.0.1
|
||||
|
||||
save/quit
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
||||
## Register SSL test environment ( only with public IP )
|
||||
|
||||
Register SSL with letsencrypt-issuer
|
||||
|
||||
````
|
||||
cat > nginx.yml <<EOF
|
||||
apiVersion: certmanager.k8s.io/v1alpha1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: example-rug-nl
|
||||
namespace: default
|
||||
spec:
|
||||
secretName: letsencrypt-issuer-tls
|
||||
issuerRef:
|
||||
name: letsencrypt-issuer
|
||||
dnsNames:
|
||||
- example.rug.nl
|
||||
acme:
|
||||
config:
|
||||
- http01:
|
||||
ingress: nginx
|
||||
domains:
|
||||
- example.rug.nl
|
||||
EOF
|
||||
````
|
||||
kubectl apply -f nginx.yml
|
||||
|
||||
|
||||
## Simple deployment
|
||||
|
||||
````
|
||||
cat > simple.yml <<EOF
|
||||
|
||||
metadata:
|
||||
name: nginx-service-example-rug-nl
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: nginx-service-example-rug-nl
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: nginx-service-example-rug-nl
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
containers:
|
||||
- name: nginx-service-example-rug-nl
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: host-based-ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: example.rug.nl
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: nginx-service-example-rug-nl
|
||||
servicePort: 80
|
||||
EOF
|
||||
|
||||
````
|
||||
|
||||
kubectl -f simple.yml
|
||||
|
||||
|
||||
## PersistentVolume
|
||||
|
||||
````
|
||||
cat > pv.yml <<EOF
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: user
|
||||
labels:
|
||||
name: nfs4
|
||||
spec:
|
||||
storageClassName: nfs-class
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
nfs:
|
||||
server: 1.2.3.4
|
||||
path: /
|
||||
EOF
|
||||
````
|
||||
kubectl apply -f pv.yml
|
||||
|
||||
|
||||
## PersistentVolumeClaim
|
||||
|
||||
````
|
||||
cat > pvc.yml <<EOF
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: user
|
||||
spec:
|
||||
storageClassName: nfs-class
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
EOF
|
||||
````
|
||||
|
||||
kubectl apply -f pvc.yaml
|
||||
|
||||
## Service
|
||||
|
||||
````
|
||||
cat > service.yml <<EOF
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: service-name
|
||||
labels:
|
||||
app: service-name
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: service-name
|
||||
|
||||
EOF
|
||||
````
|
||||
kubectl apply -f service.yml
|
||||
|
||||
## Deployment
|
||||
|
||||
````
|
||||
cat > deploy.yml <<EOF
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: example
|
||||
labels:
|
||||
app: example
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: example
|
||||
minReadySeconds: 10
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: example
|
||||
version: v0.2
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
containers:
|
||||
- name: example
|
||||
image: nginx
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: WEBSERVER
|
||||
value: NGINX
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 2
|
||||
successThreshold: 2
|
||||
timeoutSeconds: 2
|
||||
tty: true
|
||||
volumeMounts:
|
||||
- mountPath: /var/www
|
||||
name: user
|
||||
dnsPolicy: ClusterFirst
|
||||
hostAliases:
|
||||
- hostnames:
|
||||
- example.rug.nl
|
||||
ip: 127.0.0.1
|
||||
imagePullSecrets:
|
||||
- name: registry
|
||||
restartPolicy: Always
|
||||
schedulerName: default-scheduler
|
||||
terminationGracePeriodSeconds: 30
|
||||
volumes:
|
||||
- name: user
|
||||
persistentVolumeClaim:
|
||||
claimName: user
|
||||
EOF
|
||||
````
|
||||
kubectl apply -f deploy.yml
|
||||
|
||||
## HTTPS
|
||||
|
||||
````
|
||||
cat > https.yml <<EOF
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
annotations:
|
||||
ingress.kubernetes.io/ssl-redirect: "true"
|
||||
name: example
|
||||
namespace: default
|
||||
spec:
|
||||
rules:
|
||||
- host: example.rug.nl
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: example
|
||||
servicePort: 80
|
||||
tls:
|
||||
- secretName: letsencrypt-issuer-tls
|
||||
hosts:
|
||||
- example.rug.nl
|
||||
EOF
|
||||
````
|
||||
|
||||
kubectl -f apply https.yml
|
||||
|
||||
|
||||
## Ingress annotations
|
||||
|
||||
### redirect SSL
|
||||
````
|
||||
nginx.ingress.kubernetes.io/server-snippet =
|
||||
|
||||
if ($http_x_ssl_enabled != "true") {
|
||||
rewrite ^ https://$host$request_uri? permanent;
|
||||
}
|
||||
````
|
||||
|
||||
### Ingress app root
|
||||
Set application root to /wp
|
||||
|
||||
````
|
||||
nginx.ingress.kubernetes.io/app-root = /wp
|
||||
|
||||
````
|
||||
|
||||
|
||||
### Ingress app root force https
|
||||
Set application root to /wp
|
||||
|
||||
````
|
||||
nginx.ingress.kubernetes.io/app-root = /wp
|
||||
nginx.ingress.kubernetes.io/force-ssl-redirect = true
|
||||
|
||||
````
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Cheat sheet
|
||||
|
||||
````
|
||||
### cluster
|
||||
kubectl get services # List all services
|
||||
kubectl get pods # List all pods
|
||||
kubectl get nodes -w # Watch nodes continuously
|
||||
kubectl version # Get version information
|
||||
kubectl cluster-info # Get cluster information
|
||||
kubectl config view # Get the configuration
|
||||
kubectl describe node <node> # Output information about a node
|
||||
|
||||
### pod and container
|
||||
kubectl get pods # List the current pods
|
||||
kubectl describe pod <name> # Describe pod <name>
|
||||
kubectl get rc # List the replication controllers
|
||||
kubectl get rc --namespace="<namespace>" # List the replication controllers in <namespace>
|
||||
kubectl describe rc <name> # Describe replication controller <name>
|
||||
kubectl get svc # List the services
|
||||
kubectl describe svc <name> # Describe service <name>
|
||||
|
||||
### interacting
|
||||
|
||||
kubectl run <name> --image=<image-name> # Launch a pod called <name>
|
||||
# using image <image-name>
|
||||
|
||||
kubectl create -f <manifest.yaml> # Create a service described
|
||||
# in <manifest.yaml>
|
||||
|
||||
kubectl scale --replicas=<count> rc <name> # Scale replication controller
|
||||
# <name> to <count> instances
|
||||
|
||||
kubectl expose rc <name> --port=<external> --target-port=<internal> # Map port <external> to
|
||||
# port <internal> on replication
|
||||
# controller <name>
|
||||
|
||||
### stopping
|
||||
kubectl delete pod <name> # Delete pod <name>
|
||||
kubectl delete rc <name> # Delete replication controller <name>
|
||||
kubectl delete svc <name> # Delete service <name>
|
||||
kubectl drain <n> --delete-local-data --force --ignore-daemonsets # Stop all pods on <n>
|
||||
kubectl delete node <name>
|
||||
|
||||
### administration
|
||||
kubeadm init # Initialize your master node
|
||||
kubeadm join --token <token> <master-ip>:<master-port> # Join a node to your Kubernetes cluster
|
||||
kubectl create namespace <namespace> # Create namespace <name>
|
||||
kubectl taint nodes --all node-role.kubernetes.io/master- # Allow Kubernetes master nodes to run pods
|
||||
kubeadm reset # Reset current state
|
||||
|
||||
kubectl get secrets
|
||||
|
||||
|
||||
````
|
||||
|
10
docs/rancher-err.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Api Server
|
||||
````
|
||||
Failed to communicate with API server: Get https:///api/v1/componentstatuses?timeout=30s: waiting for cluster agent to connect :
|
||||
|
||||
ssh to the node and remove k8s_agent_cattle-node-agent
|
||||
|
||||
docker ps | grep -i agent
|
||||
docker rmi $ID
|
||||
|
||||
````
|
4
docs/rancher2.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Rancher
|
||||
````
|
||||
|
||||
````
|
BIN
docs/screenshots/amelia.png
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
docs/screenshots/cerulean.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/screenshots/cosmo.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
docs/screenshots/cyborg.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/screenshots/flatly.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
docs/screenshots/journal.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/screenshots/readable.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
docs/screenshots/simplex.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
docs/screenshots/slate.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
docs/screenshots/spacelab.png
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
docs/screenshots/united.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
docs/screenshots/yeti.png
Normal file
After Width: | Height: | Size: 72 KiB |
4
docs/sub-dir/sub-dir-2/sub-page-2.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Sub Page 2
|
||||
|
||||
This page is simply here to demonstrate multiple levels of navigation in the
|
||||
theme.
|
6
docs/sub-dir/sub-page.md
Normal file
@@ -0,0 +1,6 @@
|
||||
title: Sub page
|
||||
|
||||
# Sub Page 1
|
||||
|
||||
This page is simply here to demonstrate multiple levels of navigation in the
|
||||
theme.
|