forked from yankils/Simple-DevOps-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
782c0ce
commit b57d03d
Showing
1 changed file
with
48 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Integrating Kubernetes cluster with Ansible --- In progress | ||
|
||
1. Log into ansible server and copy public key onto Kubernetes cluster master account | ||
|
||
1. update hosts file with a new group called Kubernetes and add Kubernetes master in that. | ||
|
||
1. write playbooks to create a pods and services | ||
|
||
#### create-deployment.yml | ||
```sh | ||
---- | ||
- name: Create pods using deployment | ||
hosts: kubernetes | ||
become: true | ||
user: root | ||
|
||
tasks: | ||
- name: pull latest docker image | ||
command: docker pull yankils/simple-devops-image | ||
|
||
- name: create a deployment | ||
command: kubectl apply -f valaxy-deploy.yml | ||
``` | ||
|
||
#### create-service.yml | ||
```sh | ||
--- | ||
- name: create service for deployment | ||
hosts: kubernetes | ||
become: true | ||
user: root | ||
|
||
tasks | ||
- name: create a service | ||
command: kubectl apply -f valaxy-service.yml | ||
|
||
1. Check for pods, deployments and services on kubernetes master | ||
```sh | ||
kubectl get pods | ||
kubectl get deploy | ||
kubectl get service | ||
``` | ||
|
||
1. Access application suing Loadbalancer URL | ||
``` | ||
wget <service_ip>:8080 | ||
http:https://<LoadBalancerURL> | ||
|