Merge pull request #123 from stazdx/aks-terraform
Running it in (Azure Kubernetes Service) AKS by using Terraform, Azure CLI, Kompose & Kubectl
This commit is contained in:
commit
b3c8cb3cce
80
aks-terraform/README.md
Normal file
80
aks-terraform/README.md
Normal file
|
@ -0,0 +1,80 @@
|
|||
# Kubernetes & Azure (AKS, Terraform, Kompose, Kubectl, Azure CLI)
|
||||
|
||||
- Azure CLI configuration
|
||||
- Infrastructure as code for Azure
|
||||
- Generating Kubernetes configuration files with Kompose (Services, Deployments, Pods & Persistent volumes)
|
||||
- Terraform with Azure Provider
|
||||
- Kubectl configuration
|
||||
|
||||
## Setting up Azure CLI
|
||||
|
||||
- Install Azure CLI -> https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
|
||||
- Execute ```sh $ az login ``` and authenticate with your Azure account
|
||||
- Execute ```sh $ az account show --query "{subscriptionId:id, tenantId:tenantId" ``` . Then copy subscriptionId and tenantId
|
||||
- Execute ```sh $ az account set --subscription="${SUBSCRIPTION_ID}" ``` . Replace ${SUBSCRIPTION_ID} for your subscriptionId copied
|
||||
|
||||
## Create infrastucture in Azure (AKS Service with node master)
|
||||
|
||||
Terraform version >= v0.11.7
|
||||
|
||||
- Install Terraform -> https://www.terraform.io/downloads.html
|
||||
- Edit vars with Azure Account values in ```sh terraform.tfvars ```
|
||||
- After that:
|
||||
|
||||
```sh
|
||||
$ terraform init
|
||||
$ terraform plan
|
||||
$ terraform apply
|
||||
```
|
||||
|
||||
## Setting up Kubectl with Azure account
|
||||
|
||||
- For apply Kubernetes files:
|
||||
|
||||
First configurate azure-cli with Azure account and install kubernetes tools with az:
|
||||
|
||||
```sh
|
||||
$ az aks install-cli
|
||||
```
|
||||
|
||||
Then log in in to the Azure Container Registry (if you're using it, but dockerhub or other):
|
||||
|
||||
```sh
|
||||
$ az acr login
|
||||
```
|
||||
|
||||
After that, connect to cluster with Kubectl:
|
||||
|
||||
```sh
|
||||
$ az aks get-credentials --resource-group docker-android --name k8s-docker-android
|
||||
```
|
||||
|
||||
## Generate Kube files with Kompose
|
||||
|
||||
- Install Kompose -> https://github.com/kubernetes/kompose
|
||||
|
||||
Kompose version: >= 1.1.0
|
||||
|
||||
- For convert to Kompose:
|
||||
|
||||
```sh
|
||||
$ cd kompose
|
||||
$ kompose convert -f ../kompose.yml
|
||||
```
|
||||
|
||||
## Execute Kube files
|
||||
|
||||
- First create Persistent Volume Claims, then Services; finally Deployments files. For example:
|
||||
|
||||
```sh
|
||||
$ cd kompose
|
||||
$ kubectl create -f nexus-7.1.1-claim0-persistentvolumeclaim.yaml
|
||||
$ kubectl create -f nexus-7.1.1-claim1-persistentvolumeclaim.yaml
|
||||
$ kubectl create -f nexus-7.1.1-service.yaml
|
||||
$ kubectl create -f nexus-7.1.1-deployment.yaml
|
||||
```
|
||||
|
||||
## Running with custom K8s files
|
||||
|
||||
(To Do)
|
||||
|
114
aks-terraform/kompose.yml
Executable file
114
aks-terraform/kompose.yml
Executable file
|
@ -0,0 +1,114 @@
|
|||
# Note: It requires docker-compose 1.13.0
|
||||
#
|
||||
# Usage: docker-compose up -d
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
# Selenium hub
|
||||
selenium_hub:
|
||||
image: selenium/hub:3.14.0-curium
|
||||
ports:
|
||||
- 4444:4444
|
||||
|
||||
# There is a bug for using appium. Issue: https://github.com/butomo1989/docker-android/issues/73
|
||||
# Real devices
|
||||
#real_device:
|
||||
# image: butomo1989/docker-android-real-device
|
||||
# privileged: true
|
||||
# depends_on:
|
||||
# - selenium_hub
|
||||
# ports:
|
||||
# - 6080:6080
|
||||
# volumes:
|
||||
# - ./video-real-device:/tmp/video
|
||||
# - /dev/bus/usb:/dev/bus/usb
|
||||
# - ~/.android:/root/.android
|
||||
# environment:
|
||||
# - CONNECT_TO_GRID=true
|
||||
# - APPIUM=true
|
||||
# - SELENIUM_HOST=selenium_hub
|
||||
# - AUTO_RECORD=true
|
||||
# - BROWSER_NAME=chrome
|
||||
|
||||
# Using Appium Docker Android
|
||||
real_device:
|
||||
image: appium/appium
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
network_mode: "service:selenium_hub"
|
||||
privileged: true
|
||||
volumes:
|
||||
- /dev/bus/usb:/dev/bus/usb
|
||||
- ~/.android:/root/.android
|
||||
- ../example/sample_apk:/root/tmp
|
||||
environment:
|
||||
- CONNECT_TO_GRID=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
# Enable it for msite testing
|
||||
#- BROWSER_NAME=chrome
|
||||
|
||||
# Docker-Android for Android application testing
|
||||
nexus_7.1.1:
|
||||
image: butomo1989/docker-android-x86-7.1.1
|
||||
privileged: true
|
||||
# Increase scale number if needed
|
||||
#scale: 1
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
- real_device
|
||||
ports:
|
||||
- 6080
|
||||
# Change path of apk that you want to test. I use sample_apk that I provide in folder "example"
|
||||
volumes:
|
||||
- ../example/sample_apk:/root/tmp/sample_apk
|
||||
- ../video-nexus_7.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Nexus 5
|
||||
- CONNECT_TO_GRID=true
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- AUTO_RECORD=true
|
||||
|
||||
# Docker-Android for mobile website testing with chrome browser
|
||||
# Chrome browser exists only for version 7.0 and 7.1.1
|
||||
samsung_galaxy_web_7.1.1:
|
||||
image: butomo1989/docker-android-x86-8.1
|
||||
privileged: true
|
||||
# Increase scale number if needed
|
||||
#scale: 1
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
- real_device
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ../video-samsung_7.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Samsung Galaxy S6
|
||||
- CONNECT_TO_GRID=true
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- MOBILE_WEB_TEST=true
|
||||
- AUTO_RECORD=true
|
||||
|
||||
# Docker-Android for mobile website testing with default browser
|
||||
# Default browser exists only for version 5.0.1, 5.1.1 and 6.0
|
||||
samsung_galaxy_web_5.1.1:
|
||||
image: butomo1989/docker-android-x86-5.1.1
|
||||
privileged: true
|
||||
# Increase scale number if needed
|
||||
#scale: 1
|
||||
depends_on:
|
||||
- selenium_hub
|
||||
- real_device
|
||||
ports:
|
||||
- 6080
|
||||
volumes:
|
||||
- ../video-samsung_5.1.1:/tmp/video
|
||||
environment:
|
||||
- DEVICE=Samsung Galaxy S6
|
||||
- CONNECT_TO_GRID=true
|
||||
- APPIUM=true
|
||||
- SELENIUM_HOST=selenium_hub
|
||||
- MOBILE_WEB_TEST=true
|
||||
- AUTO_RECORD=true
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: nexus-7.1.1-claim0
|
||||
name: nexus-7.1.1-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: nexus-7.1.1-claim1
|
||||
name: nexus-7.1.1-claim1
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
53
aks-terraform/kompose/nexus-7.1.1-deployment.yaml
Normal file
53
aks-terraform/kompose/nexus-7.1.1-deployment.yaml
Normal file
|
@ -0,0 +1,53 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: nexus-7.1.1
|
||||
name: nexus-7.1.1
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: nexus-7.1.1
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: APPIUM
|
||||
value: "true"
|
||||
- name: AUTO_RECORD
|
||||
value: "true"
|
||||
- name: CONNECT_TO_GRID
|
||||
value: "true"
|
||||
- name: DEVICE
|
||||
value: Nexus 5
|
||||
- name: SELENIUM_HOST
|
||||
value: selenium_hub
|
||||
image: butomo1989/docker-android-x86-7.1.1
|
||||
name: nexus-7.1.1
|
||||
ports:
|
||||
- containerPort: 6080
|
||||
resources: {}
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /root/tmp/sample_apk
|
||||
name: nexus-7.1.1-claim0
|
||||
- mountPath: /tmp/video
|
||||
name: nexus-7.1.1-claim1
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: nexus-7.1.1-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: nexus-7.1.1-claim0
|
||||
- name: nexus-7.1.1-claim1
|
||||
persistentVolumeClaim:
|
||||
claimName: nexus-7.1.1-claim1
|
||||
status: {}
|
19
aks-terraform/kompose/nexus-7.1.1-service.yaml
Normal file
19
aks-terraform/kompose/nexus-7.1.1-service.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: nexus-7.1.1
|
||||
name: nexus-7.1.1
|
||||
spec:
|
||||
ports:
|
||||
- name: "6080"
|
||||
port: 6080
|
||||
targetPort: 6080
|
||||
selector:
|
||||
io.kompose.service: nexus-7.1.1
|
||||
status:
|
||||
loadBalancer: {}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: real-device-claim0
|
||||
name: real-device-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: real-device-claim1
|
||||
name: real-device-claim1
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: real-device-claim2
|
||||
name: real-device-claim2
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
50
aks-terraform/kompose/real-device-deployment.yaml
Normal file
50
aks-terraform/kompose/real-device-deployment.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: real-device
|
||||
name: real-device
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: real-device
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: CONNECT_TO_GRID
|
||||
value: "true"
|
||||
- name: SELENIUM_HOST
|
||||
value: selenium_hub
|
||||
image: appium/appium
|
||||
name: real-device
|
||||
resources: {}
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /dev/bus/usb
|
||||
name: real-device-claim0
|
||||
- mountPath: /root/.android
|
||||
name: real-device-claim1
|
||||
- mountPath: /root/tmp
|
||||
name: real-device-claim2
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: real-device-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: real-device-claim0
|
||||
- name: real-device-claim1
|
||||
persistentVolumeClaim:
|
||||
claimName: real-device-claim1
|
||||
- name: real-device-claim2
|
||||
persistentVolumeClaim:
|
||||
claimName: real-device-claim2
|
||||
status: {}
|
20
aks-terraform/kompose/real-device-service.yaml
Normal file
20
aks-terraform/kompose/real-device-service.yaml
Normal file
|
@ -0,0 +1,20 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: real-device
|
||||
name: real-device
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: headless
|
||||
port: 55555
|
||||
targetPort: 0
|
||||
selector:
|
||||
io.kompose.service: real-device
|
||||
status:
|
||||
loadBalancer: {}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-5.1.1-claim0
|
||||
name: samsung-galaxy-web-5.1.1-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
|
@ -0,0 +1,50 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||
name: samsung-galaxy-web-5.1.1
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: APPIUM
|
||||
value: "true"
|
||||
- name: AUTO_RECORD
|
||||
value: "true"
|
||||
- name: CONNECT_TO_GRID
|
||||
value: "true"
|
||||
- name: DEVICE
|
||||
value: Samsung Galaxy S6
|
||||
- name: MOBILE_WEB_TEST
|
||||
value: "true"
|
||||
- name: SELENIUM_HOST
|
||||
value: selenium_hub
|
||||
image: butomo1989/docker-android-x86-5.1.1
|
||||
name: samsung-galaxy-web-5.1.1
|
||||
ports:
|
||||
- containerPort: 6080
|
||||
resources: {}
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /tmp/video
|
||||
name: samsung-galaxy-web-5.1.1-claim0
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: samsung-galaxy-web-5.1.1-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: samsung-galaxy-web-5.1.1-claim0
|
||||
status: {}
|
19
aks-terraform/kompose/samsung-galaxy-web-5.1.1-service.yaml
Normal file
19
aks-terraform/kompose/samsung-galaxy-web-5.1.1-service.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||
name: samsung-galaxy-web-5.1.1
|
||||
spec:
|
||||
ports:
|
||||
- name: "6080"
|
||||
port: 6080
|
||||
targetPort: 6080
|
||||
selector:
|
||||
io.kompose.service: samsung-galaxy-web-5.1.1
|
||||
status:
|
||||
loadBalancer: {}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-7.1.1-claim0
|
||||
name: samsung-galaxy-web-7.1.1-claim0
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 100Mi
|
||||
status: {}
|
|
@ -0,0 +1,50 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||
name: samsung-galaxy-web-7.1.1
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: APPIUM
|
||||
value: "true"
|
||||
- name: AUTO_RECORD
|
||||
value: "true"
|
||||
- name: CONNECT_TO_GRID
|
||||
value: "true"
|
||||
- name: DEVICE
|
||||
value: Samsung Galaxy S6
|
||||
- name: MOBILE_WEB_TEST
|
||||
value: "true"
|
||||
- name: SELENIUM_HOST
|
||||
value: selenium_hub
|
||||
image: butomo1989/docker-android-x86-8.1
|
||||
name: samsung-galaxy-web-7.1.1
|
||||
ports:
|
||||
- containerPort: 6080
|
||||
resources: {}
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- mountPath: /tmp/video
|
||||
name: samsung-galaxy-web-7.1.1-claim0
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: samsung-galaxy-web-7.1.1-claim0
|
||||
persistentVolumeClaim:
|
||||
claimName: samsung-galaxy-web-7.1.1-claim0
|
||||
status: {}
|
19
aks-terraform/kompose/samsung-galaxy-web-7.1.1-service.yaml
Normal file
19
aks-terraform/kompose/samsung-galaxy-web-7.1.1-service.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||
name: samsung-galaxy-web-7.1.1
|
||||
spec:
|
||||
ports:
|
||||
- name: "6080"
|
||||
port: 6080
|
||||
targetPort: 6080
|
||||
selector:
|
||||
io.kompose.service: samsung-galaxy-web-7.1.1
|
||||
status:
|
||||
loadBalancer: {}
|
27
aks-terraform/kompose/selenium-hub-deployment.yaml
Normal file
27
aks-terraform/kompose/selenium-hub-deployment.yaml
Normal file
|
@ -0,0 +1,27 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: selenium-hub
|
||||
name: selenium-hub
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy: {}
|
||||
template:
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: selenium-hub
|
||||
spec:
|
||||
containers:
|
||||
- image: selenium/hub:3.14.0-curium
|
||||
name: selenium-hub
|
||||
ports:
|
||||
- containerPort: 4444
|
||||
resources: {}
|
||||
restartPolicy: Always
|
||||
status: {}
|
19
aks-terraform/kompose/selenium-hub-service.yaml
Normal file
19
aks-terraform/kompose/selenium-hub-service.yaml
Normal file
|
@ -0,0 +1,19 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
kompose.cmd: kompose convert -f ../kompose.yml
|
||||
kompose.version: 1.1.0 (36652f6)
|
||||
creationTimestamp: null
|
||||
labels:
|
||||
io.kompose.service: selenium-hub
|
||||
name: selenium-hub
|
||||
spec:
|
||||
ports:
|
||||
- name: "4444"
|
||||
port: 4444
|
||||
targetPort: 4444
|
||||
selector:
|
||||
io.kompose.service: selenium-hub
|
||||
status:
|
||||
loadBalancer: {}
|
48
aks-terraform/main.tf
Normal file
48
aks-terraform/main.tf
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
resource "azurerm_container_service" "container_service" {
|
||||
name = "k8s-docker-android"
|
||||
resource_group_name = "${var.resource_group_name}"
|
||||
location = "${var.resource_group_location}"
|
||||
orchestration_platform = "Kubernetes"
|
||||
|
||||
master_profile {
|
||||
count = "${var.master_count}"
|
||||
dns_prefix = "${var.dns_name_prefix}-master"
|
||||
}
|
||||
|
||||
agent_pool_profile {
|
||||
name = "agentpools"
|
||||
count = "${var.linux_agent_count}"
|
||||
dns_prefix = "${var.dns_name_prefix}-agent"
|
||||
vm_size = "${var.linux_agent_vm_size}"
|
||||
}
|
||||
|
||||
linux_profile {
|
||||
admin_username = "${var.linux_admin_username}"
|
||||
|
||||
ssh_key {
|
||||
key_data = "${var.linux_admin_ssh_publickey}"
|
||||
}
|
||||
}
|
||||
|
||||
service_principal {
|
||||
client_id = "${var.service_principal_client_id}"
|
||||
client_secret = "${var.service_principal_client_secret}"
|
||||
}
|
||||
|
||||
diagnostics_profile {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
tags {
|
||||
Source = "K8s with Terraform"
|
||||
}
|
||||
}
|
||||
|
||||
output "master_fqdn" {
|
||||
value = "${azurerm_container_service.container_service.master_profile.fqdn}"
|
||||
}
|
||||
|
||||
output "ssh_command_master0" {
|
||||
value = "ssh ${var.linux_admin_username}@${azurerm_container_service.container_service.master_profile.fqdn} -A -p 22"
|
||||
}
|
11
aks-terraform/provider.tf
Normal file
11
aks-terraform/provider.tf
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
# Use this if you can't specify your credentials in file but you need ingress in the UI console.
|
||||
provider "azurerm" {}
|
||||
|
||||
#Use this if you can specify your credentials and no more configuration is necessary
|
||||
#provider "azurerm" {
|
||||
# subscription_id = "${var.subscription_id}"
|
||||
# client_id = "${var.service_principal_client_id}"
|
||||
# client_secret = "${var.service_principal_client_secret}"
|
||||
# tenant_id = "${var.tenant_id}"
|
||||
#}
|
19
aks-terraform/terraform.tfvars
Normal file
19
aks-terraform/terraform.tfvars
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
resource_group_name = "docker-android"
|
||||
resource_group_location = "West US"
|
||||
dns_name_prefix = "docker-android"
|
||||
linux_agent_count = "1"
|
||||
|
||||
#Only use Dv3 or Ev3 series
|
||||
linux_agent_vm_size = "Standard_D2_v3"
|
||||
|
||||
linux_admin_username = "(Insert any username here!)"
|
||||
linux_admin_ssh_publickey = "(Insert ssh key here!)"
|
||||
master_count = "1"
|
||||
|
||||
|
||||
# Azure credentials
|
||||
service_principal_client_id = "(Insert principal key client id here!)"
|
||||
service_principal_client_secret = "(Insert principal key client secret here!)"
|
||||
subscription_id = "(Insert subscription id here!)"
|
||||
tenant_id = "(Insert tenant id here!)"
|
62
aks-terraform/variables.tf
Normal file
62
aks-terraform/variables.tf
Normal file
|
@ -0,0 +1,62 @@
|
|||
variable "resource_group_name" {
|
||||
type = "string"
|
||||
description = "Name of the azure resource group."
|
||||
}
|
||||
|
||||
variable "resource_group_location" {
|
||||
type = "string"
|
||||
description = "Location of the azure resource group."
|
||||
}
|
||||
|
||||
variable "dns_name_prefix" {
|
||||
type = "string"
|
||||
description = "Sets the domain name prefix for the cluster. The suffix 'master' will be added to address the master agents and the suffix 'agent' will be added to address the linux agents."
|
||||
}
|
||||
|
||||
variable "linux_agent_count" {
|
||||
type = "string"
|
||||
default = "1"
|
||||
description = "The number of Kubernetes linux agents in the cluster. Allowed values are 1-100 (inclusive). The default value is 1."
|
||||
}
|
||||
|
||||
variable "linux_agent_vm_size" {
|
||||
type = "string"
|
||||
default = "Standard_D2_v2"
|
||||
description = "The size of the virtual machine used for the Kubernetes linux agents in the cluster."
|
||||
}
|
||||
|
||||
variable "linux_admin_username" {
|
||||
type = "string"
|
||||
description = "User name for authentication to the Kubernetes linux agent virtual machines in the cluster."
|
||||
}
|
||||
|
||||
variable "linux_admin_ssh_publickey" {
|
||||
type = "string"
|
||||
description = "Configure all the linux virtual machines in the cluster with the SSH RSA public key string. The key should include three parts, for example 'ssh-rsa AAAAB...snip...UcyupgH azureuser@linuxvm'"
|
||||
}
|
||||
|
||||
variable "master_count" {
|
||||
type = "string"
|
||||
default = "1"
|
||||
description = "The number of Kubernetes masters for the cluster. Allowed values are 1, 3, and 5. The default value is 1."
|
||||
}
|
||||
|
||||
variable "service_principal_client_id" {
|
||||
type = "string"
|
||||
description = "The client id of the azure service principal used by Kubernetes to interact with Azure APIs."
|
||||
}
|
||||
|
||||
variable "service_principal_client_secret" {
|
||||
type = "string"
|
||||
description = "The client secret of the azure service principal used by Kubernetes to interact with Azure APIs."
|
||||
}
|
||||
|
||||
variable "subscription_id" {
|
||||
type = "string"
|
||||
description = "Your Azure subscription"
|
||||
}
|
||||
|
||||
variable "tenant_id" {
|
||||
type = "string"
|
||||
description = "Your Azure Tenant id"
|
||||
}
|
Loading…
Reference in a new issue