-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make test cluster actually work - networking-wise.
- Loading branch information
1 parent
978f556
commit 0be3757
Showing
11 changed files
with
124 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
hello-go/hello | ||
*/roles/geerlingguy.* | ||
.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[defaults] | ||
roles_path = ./roles | ||
nocows = 1 | ||
host_key_checking = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: hello-k8s | ||
namespace: default | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: hello-k8s | ||
template: | ||
metadata: | ||
labels: | ||
app: hello-k8s | ||
spec: | ||
containers: | ||
- name: hello-k8s | ||
image: paulbouwer/hello-kubernetes:1.5 | ||
ports: | ||
- containerPort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: hello-k8s | ||
namespace: default | ||
spec: | ||
type: NodePort | ||
ports: | ||
- port: 8080 | ||
targetPort: 8080 | ||
selector: | ||
app: hello-k8s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- kube-flannel.yml 2019-12-18 09:29:04.000000000 -0600 | ||
+++ kube-flannel-virtualbox.yml 2019-12-18 09:30:01.000000000 -0600 | ||
@@ -189,6 +189,7 @@ | ||
args: | ||
- --ip-masq | ||
- --kube-subnet-mgr | ||
+ - --iface=enp0s8 | ||
resources: | ||
requests: | ||
cpu: "100m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
- name: Retrieve current flannel manifest from GitHub. | ||
get_url: | ||
url: https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml | ||
dest: ~/kube-flannel.yml | ||
|
||
- name: Patch Flannel manifest with VirtualBox interface. | ||
patch: | ||
src: files/kube-flannel-patch.txt | ||
dest: ~/kube-flannel.yml | ||
|
||
- name: Set the correct path for the patched Flannel manifest. | ||
set_fact: | ||
kubernetes_flannel_manifest_file: ~/kube-flannel.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
- hosts: kube1 | ||
become: true | ||
|
||
vars_files: | ||
- vars/main.yml | ||
|
||
pre_tasks: | ||
- name: Ensure k8s module dependencies are installed. | ||
pip: | ||
name: openshift | ||
state: present | ||
|
||
tasks: | ||
- name: Create hello-k8s Deployment and Service. | ||
k8s: | ||
state: present | ||
definition: "{{ lookup('file', 'files/' + item) }}" | ||
with_items: | ||
- hello-k8s-deployment.yml | ||
- hello-k8s-service.yml | ||
|
||
- name: Wait for hello-k8s pods to be ready. | ||
command: > | ||
kubectl wait --for=condition=Ready | ||
pods --selector app=hello-k8s --timeout=60s | ||
changed_when: false | ||
|
||
- name: Get hello-k8s service details. | ||
k8s_info: | ||
kind: Service | ||
name: hello-k8s | ||
namespace: default | ||
register: svc | ||
|
||
- name: Set the service NodePort as a variable. | ||
set_fact: | ||
port: "{{ svc['resources'][0]['spec']['ports'][0]['nodePort'] }}" | ||
|
||
- name: Test a request to the service. | ||
uri: | ||
url: http://{{ ansible_host }}:{{ port }}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters