Skip to content

amen619/vagrant-ansible-kubernetes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubernetes Setup Using Ansible and Vagrant

TOC

Vagrantfile compatibility versions

Vagrant version Virtualbox version
v2.2.4 Version 6.0.10 r132072 (Qt5.6.2)
v2.2.5 Version 6.0.10 r132072 (Qt5.6.2)
Version 6.0.10 r132072 (Qt5.9.5)

Useful links

Useful commands

# Get kubernetes cluster up and ready
$> cd /path/to/Vagrantfile
$> vagrant up
## Accessing master
$> vagrant ssh k8s-master
vagrant@k8s-master:~$ kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
k8s-master   Ready    master   18m     v1.16.3
node-1       Ready    <none>   10m     v1.16.3
node-2       Ready    <none>   2m37s   v1.16.3

## Accessing nodes
$> vagrant ssh node-1
$> vagrant ssh node-2
# Remove kubernetes cluster
$> cd /path/to/Vagrantfile
$> vagrant destroy -f

Kubernetes commands

# Get available versions
$> kubectl api-versions
# Get available resources
$> kubectl api-resources
# Get Kubernetes version
$> kubectl version
# Get Kubernetes Namespaces
$> kubectl get namespaces
# Get Kubernetes nodes
$> kubectl get nodes
# Running a single pod 
$> kubectl run my-apache --image httpd
# List pods
$> kubectl get pods
# List all objects
$> kubectl get all
# Scaling pods
$> kubectl scale deployment my-apache --replicas 2
# Geting logs 
$> kubectl logs deployment/my-apache
# Describing pod
$> kubectl describe pod my-apache-<hash>-<hash>
# See deployment history
$> kubectl roolout history deployment <deployment-name>

Helm commands

# Build and name a new chart
$> helm create <chart-name>
# Test template 
$> helm install <chart-name> --debug --dry-run --generate-name
# Deploy template
$> helm install <chart-name> --generate-name
$> helm install <name> <chart-name>
# Delete all charts
$> helm del $(helm ls --all --short)
# Downloading a new chart
$> helm fetch stable/kibana
$> helm fetch stable/kibana --untar
# Listing repositories
$> helm repo list
# Listing available charts in repository
$> helm repo update
$> helm search repo <repo-name>
# Adding new repository
$> helm repo add <helm_repository_name> http://<host>:<port>/repository/<nexus_repository_name>/ --username <username> --password <password>
# Uploading a chart to Nexus3 (https://github.com/sonatype-nexus-community/helm-nexus-push)
$> helm package <chart-name>
$> helm plugin install --version master https://github.com/sonatype-nexus-community/helm-nexus-push.git
$> helm nexus-push <repo> <chart>.tgz --username <username> --password <password>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 35.2%
  • HTML 26.5%
  • Dockerfile 22.8%
  • Shell 15.5%