Giter Club home page Giter Club logo

kubeadm-single-node-cluster's Introduction

kubeadm: Single Node Kubernetes Cluster

This tutorial will walk you through bootstrapping a single-node Kubernetes cluster on Google Compute Engine using kubeadm.

Tutorial

Create a single compute instance:

gcloud compute instances create kubeadm-single-node-cluster \
  --can-ip-forward \
  --image-family ubuntu-1704 \
  --image-project ubuntu-os-cloud \
  --machine-type n1-standard-4 \
  --metadata kubernetes-version=stable-1.7,startup-script-url=https://raw.githubusercontent.com/kelseyhightower/kubeadm-single-node-cluster/master/startup.sh \
  --tags kubeadm-single-node-cluster \
  --scopes cloud-platform,logging-write

Enable secure remote access to the Kubernetes API server:

gcloud compute firewall-rules create default-allow-kubeadm-single-node-cluster \
  --allow tcp:6443 \
  --target-tags kubeadm-single-node-cluster \
  --source-ranges 0.0.0.0/0

Fetch the client kubernetes configuration file:

gcloud compute scp kubeadm-single-node-cluster:/etc/kubernetes/admin.conf \
  kubeadm-single-node-cluster.conf

It may take a few minutes for the cluster to finish bootstrapping and the client config to become readable.

Set the kubeadm-single-node-cluster kubeconfig server address to the public IP address:

kubectl config set-cluster kubernetes \
  --kubeconfig kubeadm-single-node-cluster.conf \
  --server https://$(gcloud compute instances describe kubeadm-single-node-cluster \
     --format='value(networkInterfaces.accessConfigs[0].natIP)'):6443

Set the KUBECONFIG env var to point to the kubeadm-single-node-cluster.conf kubeconfig:

export KUBECONFIG=$(PWD)/kubeadm-single-node-cluster.conf

Verification

List the Kubernetes nodes:

kubectl get nodes
NAME                          STATUS    AGE       VERSION
kubeadm-single-node-cluster   Ready     51s       v1.7.3

Create a nginx deployment:

kubectl run nginx --image nginx:1.13 --port 80

Expose the nginx deployment:

kubectl expose deployment nginx --type LoadBalancer

Cleanup

gcloud compute instances delete kubeadm-single-node-cluster
gcloud compute firewall-rules delete default-allow-kubeadm-single-node-cluster
rm kubeadm-single-node-cluster.conf

kubeadm-single-node-cluster's People

Contributors

ahmetb avatar kelseyhightower avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.