Skip to content

Commit

Permalink
Updated docs for Windows Kubernetes (#73)
Browse files Browse the repository at this point in the history
* new release note and readme

* change docs and added windows k8s deploy yaml
  • Loading branch information
keikhara committed Sep 19, 2017
1 parent 3c5d277 commit 83a69d0
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Kubernetes/README.md
@@ -1,11 +1,13 @@
## How to use the Kubernetes yaml files
## How to use the Kubernetes yaml files for Linux Server

In this folder, we have 3 yaml files.
- Default OMS Agent Daemon-set which does not have secrets (omsagent.yaml)
- OMS Agent Daemon-set yaml file which uses secrets (omsagent-ds-secrets.yaml) with secret generation scripts which generates the secrets yaml (omsagentsecret.yaml).

You can select to create omsagent daemonsets with or without secrets. Here are the instructions:

If you are looking for Windows Kubernetes, please go [here.](windows/.)

### Without Secret
1. For the Default OMS Agent Daemon-set yaml file, please make sure to replace the `<WSID>` and `<KEY>` to your WSID and KEY.
Copy file to your master node and run
Expand Down
5 changes: 0 additions & 5 deletions Kubernetes/omsagent-ds-secrets.yaml
Expand Up @@ -24,8 +24,6 @@ spec:
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-sock
- mountPath: /var/opt/microsoft/omsagent/state/containerhostname
name: container-hostname
- mountPath: /var/log
name: host-log
- mountPath: /etc/omsagent-secret
Expand All @@ -43,9 +41,6 @@ spec:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
- name: container-hostname
hostPath:
path: /etc/hostname
- name: host-log
hostPath:
path: /var/log
Expand Down
51 changes: 51 additions & 0 deletions Kubernetes/windows/README.md
@@ -0,0 +1,51 @@
## How to use the Kubernetes yaml files for Windows Server

In this folder, we have 2 yaml files.
- OMS Agent deployment yaml file which uses secrets (ws-omsagent-de-secrets.yaml) with secret generation scripts which generates the secrets yaml (omsagentsecret.yaml).

### With Secret
1. To use OMS Agent Daemon-set using Secrets, create the secrets first.

- Copy the script and secret template file and make sure they are on the same directory.
- secret generating script - secret-gen.sh
- secret template - secret-template.yaml
- Run the script. The script will ask for the OMS Workspace ID and Primary Key. Please insert that and the script will create a secret yaml file so you can run it.

```
#> sudo bash ./secret-gen.sh
```

- Create the secrets pod by running the following:
``` kubectl create -f omsagentsecret.yaml ```

- To check, run the following:

```
root@ubuntu16-13db:~# kubectl get secrets
NAME TYPE DATA AGE
default-token-gvl91 kubernetes.io/service-account-token 3 50d
omsagent-secret Opaque 2 1d
root@ubuntu16-13db:~# kubectl describe secrets omsagent-secret
Name: omsagent-secret
Namespace: default
Labels: <none>
Annotations: <none>
Type: Opaque
Data
====
WSID: 36 bytes
KEY: 88 bytes
```
- Create your omsagent daemon-set by running ``` kubectl create -f ws-omsagent-de-secrets.yaml ```

2. Check to see whether the OMS Agent deployment is running fine.
```
root@ubuntu16-13db:~# kubectl get deployment omsagent
NAME DESIRED CURRENT NODE-SELECTOR AGE
omsagent 1 1 <none> 1h
```


13 changes: 13 additions & 0 deletions Kubernetes/windows/secret-gen.sh
@@ -0,0 +1,13 @@
#!/bin/sh

echo "Enter OMS Workspace ID"
read WORKSPACE_ID
echo "Enter OMS Primary Key"
read SHARED_KEY

WSID_BASE64_ENC=$(echo $WORKSPACE_ID | base64 | tr -d '\n')
KEY_BASE64_ENC=$(echo $SHARED_KEY | base64 | tr -d '\n')
sed -e "s#{{wsid_data}}#${WSID_BASE64_ENC}#g" -e "s#{{key_data}}#${KEY_BASE64_ENC}#g" ./secret-template.yaml > omsagentsecret.yaml
#sed -e "s#{{key_data}}#${KEY_BASE64_ENC}#g" ./secret-template.yaml > secret.yaml

echo "Task completed! secret.yaml file created."
8 changes: 8 additions & 0 deletions Kubernetes/windows/secret-template.yaml
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: omsagent-secret
type: Opaque
data:
WSID: {{wsid_data}}
KEY: {{key_data}}
51 changes: 51 additions & 0 deletions Kubernetes/windows/ws-omsagent-de-secrets.yaml
@@ -0,0 +1,51 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: omsagent
spec:
template:
metadata:
labels:
app: omsagent
agentVersion: 1.4.1-45
dockerProviderVersion: 10.0.0-27
spec:
containers:
- name: omsagent
image: "microsoft/oms"
imagePullPolicy: Always
securityContext:
privileged: true
ports:
- containerPort: 25225
protocol: TCP
- containerPort: 25224
protocol: UDP
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-sock
- mountPath: /var/log
name: host-log
- mountPath: /etc/omsagent-secret
name: omsagent-secret
readOnly: true
livenessProbe:
exec:
command:
- /bin/bash
- -c
- ps -ef | grep omsagent | grep -v "grep"
initialDelaySeconds: 60
periodSeconds: 60
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
- name: host-log
hostPath:
path: /var/log
- name: omsagent-secret
secret:
secretName: omsagent-secret
nodeSelector:
role: master
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -7,7 +7,7 @@ This container solution will generate a container which will runs OMS agent with
### Supported Linux Operating Systems, Docker, and ACS Mesosphere DC/OS:

- Docker 1.11 thru 1.13
- Docker CE and EE v17.06
- Docker CE and EE v17.06+

- An x64 version of Linux OS
- Ubuntu 14.04 LTS, 16.04 LTS
Expand All @@ -19,8 +19,8 @@ This container solution will generate a container which will runs OMS agent with
- SLES 12
- RHEL 7.2, 7.3

- ACS Mesosphere DC/OS 1.7.3, 1.8.8
- ACS Kubernetes 1.4.5, 1.6
- ACS Mesosphere DC/OS 1.7.3, 1.8.8, 1.9
- ACS Kubernetes 1.4.5, 1.6+
- ACS Docker Swarm
- Redhat OpenShift (OCP) 3.4, 3.5

Expand Down

0 comments on commit 83a69d0

Please sign in to comment.