Skip to content

Instantly share code, notes, and snippets.

View lioneltchami's full-sized avatar
🏠
Working from home

Lionel Tchami lioneltchami

🏠
Working from home
View GitHub Profile
...
module "google_kubernetes_cluster" {
source = "./kubernetes_cluster"
project_id = var.project_id
region = var.region
node_zones = var.cluster_node_zones
service_account = var.service_account
network_name = module.google_networks.network.name
resource "google_container_cluster" "app_cluster" {
name = "app-cluster"
location = var.region
# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.
remove_default_node_pool = true
initial_node_count = 1
mvn_version=${mvn_version:-3.8.6}
url="http://www.mirrorservice.org/sites/ftp.apache.org/maven/maven-3/${mvn_version}/binaries/apache-maven-${mvn_version}-bin.tar.gz"
install_dir="/opt/maven"
mkdir ${install_dir}
curl -fsSL ${url} | tar zx --strip-components=1 -C ${install_dir}
cat << EOF > /etc/profile.d/maven.sh
#!/bin/sh
export MAVEN_HOME=${install_dir}
export M2_HOME=${install_dir}
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lH....Q0VSVElGSUNBVEUtLS0tLQo=
server: https://192.168.50.11:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: DATA+OMITTED
server: https://192.168.50.11:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* kubernetes-admin@kubernetes kubernetes kubernetes-admin
$ kubectl config rename-context kubernetes-admin@kubernetes kubernetes-admin@ditwl-k8s-01
Context "kubernetes-admin@kubernetes" renamed to "kubernetes-admin@ditwl-k8s-01".
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* kubernetes-admin@ditwl-k8s-01 kubernetes kubernetes-admin
jruiz@XPS13:~/git/github/terraform-kubernetes-deploy-app$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-m-1 Ready master 3h33m v1.18.6
k8s-n-1 Ready <none> 3h30m v1.18.6
k8s-n-2 Ready <none> 3h27m v1.18.6
# Copyright (C) 2018 - 2020 Apoti Tech Inc
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
# -------------------------------- WARNING --------------------------------
# Apoti Tech's best practices for infrastructure include modularizing
# Terraform configuration.
# In this example, we define everything in a single file.
# See other tutorials for Terraform best practices for Kubernetes deployments.
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 100 0 0 enx106530cde22a
link-local 0.0.0.0 255.255.0.0 U 1000 0 0 enx106530cde22a
192.168.50.0 0.0.0.0 255.255.255.0 U 0 0 0 vboxnet0
192.168.100.0 0.0.0.0 255.255.255.0 U 100 0 0 enx106530cde22a
$ ssh [email protected]
[email protected]'s password: vagrant
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-29-generic x86_64)
...
Last login: Mon Apr 22 16:45:17 2019 from 10.0.2.2