mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #13151 from pires/coreos_doc_cleanup
Clean-up CoreOS documentation.
This commit is contained in:
commit
550413750d
@ -158,7 +158,6 @@ AWS | Juju | Ubuntu | flannel | [docs](juju.md)
|
|||||||
OpenStack/HPCloud | Juju | Ubuntu | flannel | [docs](juju.md) | | [Community](https://github.com/whitmo/bundle-kubernetes) ( [@whit](https://github.com/whitmo), [@matt](https://github.com/mbruzek), [@chuck](https://github.com/chuckbutler) )
|
OpenStack/HPCloud | Juju | Ubuntu | flannel | [docs](juju.md) | | [Community](https://github.com/whitmo/bundle-kubernetes) ( [@whit](https://github.com/whitmo), [@matt](https://github.com/mbruzek), [@chuck](https://github.com/chuckbutler) )
|
||||||
Joyent | Juju | Ubuntu | flannel | [docs](juju.md) | | [Community](https://github.com/whitmo/bundle-kubernetes) ( [@whit](https://github.com/whitmo), [@matt](https://github.com/mbruzek), [@chuck](https://github.com/chuckbutler) )
|
Joyent | Juju | Ubuntu | flannel | [docs](juju.md) | | [Community](https://github.com/whitmo/bundle-kubernetes) ( [@whit](https://github.com/whitmo), [@matt](https://github.com/mbruzek), [@chuck](https://github.com/chuckbutler) )
|
||||||
AWS | Saltstack | Ubuntu | OVS | [docs](aws.md) | | Community ([@justinsb](https://github.com/justinsb))
|
AWS | Saltstack | Ubuntu | OVS | [docs](aws.md) | | Community ([@justinsb](https://github.com/justinsb))
|
||||||
Vmware | CoreOS | CoreOS | flannel | [docs](coreos.md) | | Community ([@kelseyhightower](https://github.com/kelseyhightower))
|
|
||||||
Azure | Saltstack | Ubuntu | OpenVPN | [docs](azure.md) | | Community
|
Azure | Saltstack | Ubuntu | OpenVPN | [docs](azure.md) | | Community
|
||||||
Bare-metal | custom | Ubuntu | Calico | [docs](ubuntu-calico.md) | | Community ([@djosborne](https://github.com/djosborne))
|
Bare-metal | custom | Ubuntu | Calico | [docs](ubuntu-calico.md) | | Community ([@djosborne](https://github.com/djosborne))
|
||||||
Bare-metal | custom | Ubuntu | flannel | [docs](ubuntu.md) | | Community ([@resouer](https://github.com/resouer), [@WIZARD-CXY](https://github.com/WIZARD-CXY))
|
Bare-metal | custom | Ubuntu | flannel | [docs](ubuntu.md) | | Community ([@resouer](https://github.com/resouer), [@WIZARD-CXY](https://github.com/WIZARD-CXY))
|
||||||
|
@ -1,250 +0,0 @@
|
|||||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
|
|
||||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
|
||||||
|
|
||||||
If you are using a released version of Kubernetes, you should
|
|
||||||
refer to the docs that go with that version.
|
|
||||||
|
|
||||||
<strong>
|
|
||||||
The latest 1.0.x release of this document can be found
|
|
||||||
[here](http://releases.k8s.io/release-1.0/docs/getting-started-guides/aws-coreos.md).
|
|
||||||
|
|
||||||
Documentation for other releases can be found at
|
|
||||||
[releases.k8s.io](http://releases.k8s.io).
|
|
||||||
</strong>
|
|
||||||
--
|
|
||||||
|
|
||||||
<!-- END STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
# Getting started on Amazon EC2 with CoreOS
|
|
||||||
|
|
||||||
The example below creates an elastic Kubernetes cluster with a custom number of worker nodes and a master.
|
|
||||||
|
|
||||||
**Warning:** contrary to the [supported procedure](aws.md), the examples below provision Kubernetes with an insecure API server (plain HTTP,
|
|
||||||
no security tokens, no basic auth). For demonstration purposes only.
|
|
||||||
|
|
||||||
## Highlights
|
|
||||||
|
|
||||||
* Cluster bootstrapping using [cloud-config](https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/)
|
|
||||||
* Cross container networking with [flannel](https://github.com/coreos/flannel#flannel)
|
|
||||||
* Auto worker registration with [kube-register](https://github.com/kelseyhightower/kube-register#kube-register)
|
|
||||||
* Kubernetes v0.19.3 [official binaries](https://github.com/GoogleCloudPlatform/kubernetes/releases/tag/v0.19.3)
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
* [aws CLI](http://aws.amazon.com/cli)
|
|
||||||
* [CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/)
|
|
||||||
* [kubectl CLI](aws/kubectl.md) ([installation](aws.md#command-line-administration-tool-kubectl))
|
|
||||||
|
|
||||||
## Starting a Cluster
|
|
||||||
|
|
||||||
### CloudFormation
|
|
||||||
|
|
||||||
The [cloudformation-template.json](aws/cloudformation-template.json) can be used to bootstrap a Kubernetes cluster with a single command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws cloudformation create-stack --stack-name kubernetes --region us-west-2 \
|
|
||||||
--template-body file://aws/cloudformation-template.json \
|
|
||||||
--parameters ParameterKey=KeyPair,ParameterValue=<keypair> \
|
|
||||||
ParameterKey=ClusterSize,ParameterValue=<cluster_size> \
|
|
||||||
ParameterKey=VpcId,ParameterValue=<vpc_id> \
|
|
||||||
ParameterKey=SubnetId,ParameterValue=<subnet_id> \
|
|
||||||
ParameterKey=SubnetAZ,ParameterValue=<subnet_az>
|
|
||||||
```
|
|
||||||
|
|
||||||
It will take a few minutes for the entire stack to come up. You can monitor the stack progress with the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws cloudformation describe-stack-events --stack-name kubernetes
|
|
||||||
```
|
|
||||||
|
|
||||||
Record the Kubernetes Master IP address:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws cloudformation describe-stacks --stack-name kubernetes
|
|
||||||
```
|
|
||||||
|
|
||||||
[Skip to kubectl client configuration](#configure-the-kubectl-ssh-tunnel)
|
|
||||||
|
|
||||||
### AWS CLI
|
|
||||||
|
|
||||||
The following commands shall use the latest CoreOS alpha AMI for the `us-west-2` region. For a list of different regions and corresponding AMI IDs see the [CoreOS EC2 cloud provider documentation](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
|
||||||
|
|
||||||
#### Create the Kubernetes Security Group
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws ec2 create-security-group --group-name kubernetes --description "Kubernetes Security Group"
|
|
||||||
aws ec2 authorize-security-group-ingress --group-name kubernetes --protocol tcp --port 22 --cidr 0.0.0.0/0
|
|
||||||
aws ec2 authorize-security-group-ingress --group-name kubernetes --protocol tcp --port 80 --cidr 0.0.0.0/0
|
|
||||||
aws ec2 authorize-security-group-ingress --group-name kubernetes --source-security-group-name kubernetes
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Save the master and node cloud-configs
|
|
||||||
|
|
||||||
* [master.yaml](aws/cloud-configs/master.yaml)
|
|
||||||
* [node.yaml](aws/cloud-configs/node.yaml)
|
|
||||||
|
|
||||||
#### Launch the master
|
|
||||||
|
|
||||||
*Attention:* replace `<ami_image_id>` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws ec2 run-instances --image-id <ami_image_id> --key-name <keypair> \
|
|
||||||
--region us-west-2 --security-groups kubernetes --instance-type m3.medium \
|
|
||||||
--user-data file://master.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Record the `InstanceId` for the master.
|
|
||||||
|
|
||||||
Gather the public and private IPs for the master node:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws ec2 describe-instances --instance-id <instance-id>
|
|
||||||
```
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"Reservations": [
|
|
||||||
{
|
|
||||||
"Instances": [
|
|
||||||
{
|
|
||||||
"PublicDnsName": "ec2-54-68-97-117.us-west-2.compute.amazonaws.com",
|
|
||||||
"RootDeviceType": "ebs",
|
|
||||||
"State": {
|
|
||||||
"Code": 16,
|
|
||||||
"Name": "running"
|
|
||||||
},
|
|
||||||
"PublicIpAddress": "54.68.97.117",
|
|
||||||
"PrivateIpAddress": "172.31.9.9",
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Update the node.yaml cloud-config
|
|
||||||
|
|
||||||
Edit `node.yaml` and replace all instances of `<master-private-ip>` with the **private** IP address of the master node.
|
|
||||||
|
|
||||||
### Launch 3 worker nodes
|
|
||||||
|
|
||||||
*Attention:* Replace `<ami_image_id>` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws ec2 run-instances --count 3 --image-id <ami_image_id> --key-name <keypair> \
|
|
||||||
--region us-west-2 --security-groups kubernetes --instance-type m3.medium \
|
|
||||||
--user-data file://node.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Add additional worker nodes
|
|
||||||
|
|
||||||
*Attention:* replace `<ami_image_id>` below for a [suitable version of CoreOS image for AWS](https://coreos.com/docs/running-coreos/cloud-providers/ec2/#choosing-a-channel).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws ec2 run-instances --count 1 --image-id <ami_image_id> --key-name <keypair> \
|
|
||||||
--region us-west-2 --security-groups kubernetes --instance-type m3.medium \
|
|
||||||
--user-data file://node.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configure the kubectl SSH tunnel
|
|
||||||
|
|
||||||
This command enables secure communication between the kubectl client and the Kubernetes API.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ssh -f -nNT -L 8080:127.0.0.1:8080 core@<master-public-ip>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Listing worker nodes
|
|
||||||
|
|
||||||
Once the worker instances have fully booted, they will be automatically registered with the Kubernetes API server by the kube-register service running on the master node. It may take a few mins.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get nodes
|
|
||||||
```
|
|
||||||
|
|
||||||
## Starting a simple pod
|
|
||||||
|
|
||||||
Create a pod manifest: `pod.json`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"apiVersion": "v1",
|
|
||||||
"kind": "Pod",
|
|
||||||
"metadata": {
|
|
||||||
"name": "hello",
|
|
||||||
"labels": {
|
|
||||||
"name": "hello",
|
|
||||||
"environment": "testing"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"spec": {
|
|
||||||
"containers": [{
|
|
||||||
"name": "hello",
|
|
||||||
"image": "quay.io/kelseyhightower/hello",
|
|
||||||
"ports": [{
|
|
||||||
"containerPort": 80,
|
|
||||||
"hostPort": 80
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Create the pod using the kubectl command line tool
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl create -f ./pod.json
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get pods
|
|
||||||
```
|
|
||||||
|
|
||||||
Record the **Host** of the pod, which should be the private IP address.
|
|
||||||
|
|
||||||
Gather the public IP address for the worker node.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aws ec2 describe-instances --filters 'Name=private-ip-address,Values=<host>'
|
|
||||||
```
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"Reservations": [
|
|
||||||
{
|
|
||||||
"Instances": [
|
|
||||||
{
|
|
||||||
"PublicDnsName": "ec2-54-68-97-117.us-west-2.compute.amazonaws.com",
|
|
||||||
"RootDeviceType": "ebs",
|
|
||||||
"State": {
|
|
||||||
"Code": 16,
|
|
||||||
"Name": "running"
|
|
||||||
},
|
|
||||||
"PublicIpAddress": "54.68.97.117",
|
|
||||||
```
|
|
||||||
|
|
||||||
Visit the public IP address in your browser to view the running pod.
|
|
||||||
|
|
||||||
### Delete the pod
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl delete pods hello
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
|
||||||
[]()
|
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
|
@ -98,8 +98,8 @@ NOTE: If using an existing keypair named "kubernetes" then you must set the `AWS
|
|||||||
|
|
||||||
### Alternatives
|
### Alternatives
|
||||||
|
|
||||||
A contributed [example](aws-coreos.md) allows you to setup a Kubernetes cluster based on [CoreOS](http://www.coreos.com), either using
|
A contributed [example](coreos/coreos_multinode_cluster.md) allows you to setup a Kubernetes cluster based on [CoreOS](http://www.coreos.com), using
|
||||||
AWS CloudFormation or EC2 with user data (cloud-config).
|
EC2 with user data (cloud-config).
|
||||||
|
|
||||||
## Getting started with your cluster
|
## Getting started with your cluster
|
||||||
|
|
||||||
|
@ -1,177 +0,0 @@
|
|||||||
#cloud-config
|
|
||||||
|
|
||||||
write_files:
|
|
||||||
- path: /opt/bin/waiter.sh
|
|
||||||
owner: root
|
|
||||||
permissions: 0755
|
|
||||||
content: |
|
|
||||||
#! /usr/bin/bash
|
|
||||||
until curl http://127.0.0.1:2379/v2/machines; do sleep 2; done
|
|
||||||
|
|
||||||
coreos:
|
|
||||||
etcd2:
|
|
||||||
name: master
|
|
||||||
initial-cluster-token: k8s_etcd
|
|
||||||
initial-cluster: master=http://$private_ipv4:2380
|
|
||||||
listen-peer-urls: http://$private_ipv4:2380,http://localhost:2380
|
|
||||||
initial-advertise-peer-urls: http://$private_ipv4:2380
|
|
||||||
listen-client-urls: http://$private_ipv4:2379,http://localhost:2379
|
|
||||||
advertise-client-urls: http://$private_ipv4:2379
|
|
||||||
fleet:
|
|
||||||
etcd_servers: http://localhost:2379
|
|
||||||
metadata: k8srole=master
|
|
||||||
flannel:
|
|
||||||
etcd_endpoints: http://localhost:2379
|
|
||||||
locksmithd:
|
|
||||||
endpoint: http://localhost:2379
|
|
||||||
units:
|
|
||||||
- name: etcd2.service
|
|
||||||
command: start
|
|
||||||
- name: fleet.service
|
|
||||||
command: start
|
|
||||||
- name: etcd2-waiter.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=etcd waiter
|
|
||||||
Wants=network-online.target
|
|
||||||
Wants=etcd2.service
|
|
||||||
After=etcd2.service
|
|
||||||
After=network-online.target
|
|
||||||
Before=flanneld.service fleet.service locksmithd.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/bash /opt/bin/waiter.sh
|
|
||||||
RemainAfterExit=true
|
|
||||||
Type=oneshot
|
|
||||||
- name: flanneld.service
|
|
||||||
command: start
|
|
||||||
drop-ins:
|
|
||||||
- name: 50-network-config.conf
|
|
||||||
content: |
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{"Network": "10.244.0.0/16", "Backend": {"Type": "vxlan"}}'
|
|
||||||
- name: docker-cache.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Docker cache proxy
|
|
||||||
Requires=early-docker.service
|
|
||||||
After=early-docker.service
|
|
||||||
Before=early-docker.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Restart=always
|
|
||||||
TimeoutStartSec=0
|
|
||||||
RestartSec=5
|
|
||||||
Environment=TMPDIR=/var/tmp/
|
|
||||||
Environment=DOCKER_HOST=unix:///var/run/early-docker.sock
|
|
||||||
ExecStartPre=-/usr/bin/docker kill docker-registry
|
|
||||||
ExecStartPre=-/usr/bin/docker rm docker-registry
|
|
||||||
ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest
|
|
||||||
# GUNICORN_OPTS is an workaround for
|
|
||||||
# https://github.com/docker/docker-registry/issues/892
|
|
||||||
ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \
|
|
||||||
-e STANDALONE=false \
|
|
||||||
-e GUNICORN_OPTS=[--preload] \
|
|
||||||
-e MIRROR_SOURCE=https://registry-1.docker.io \
|
|
||||||
-e MIRROR_SOURCE_INDEX=https://index.docker.io \
|
|
||||||
-e MIRROR_TAGS_CACHE_TTL=1800 \
|
|
||||||
quay.io/devops/docker-registry:latest
|
|
||||||
- name: docker.service
|
|
||||||
drop-ins:
|
|
||||||
- name: 51-docker-mirror.conf
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
# making sure that docker-cache is up and that flanneld finished
|
|
||||||
# startup, otherwise containers won't land in flannel's network...
|
|
||||||
Requires=docker-cache.service
|
|
||||||
After=docker-cache.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Environment=DOCKER_OPTS='--registry-mirror=http://$private_ipv4:5000'
|
|
||||||
- name: get-kubectl.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Get kubectl client tool
|
|
||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
||||||
Requires=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl
|
|
||||||
ExecStart=/usr/bin/chmod +x /opt/bin/kubectl
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=true
|
|
||||||
- name: kube-apiserver.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Kubernetes API Server
|
|
||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
||||||
Requires=etcd2-waiter.service
|
|
||||||
After=etcd2-waiter.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kube-apiserver
|
|
||||||
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-apiserver
|
|
||||||
ExecStart=/opt/bin/kube-apiserver \
|
|
||||||
--insecure-bind-address=0.0.0.0 \
|
|
||||||
--service-cluster-ip-range=10.100.0.0/16 \
|
|
||||||
--etcd-servers=http://localhost:2379
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
- name: kube-controller-manager.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Kubernetes Controller Manager
|
|
||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
||||||
Requires=kube-apiserver.service
|
|
||||||
After=kube-apiserver.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kube-controller-manager
|
|
||||||
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-controller-manager
|
|
||||||
ExecStart=/opt/bin/kube-controller-manager \
|
|
||||||
--master=127.0.0.1:8080
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
- name: kube-scheduler.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Kubernetes Scheduler
|
|
||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
||||||
Requires=kube-apiserver.service
|
|
||||||
After=kube-apiserver.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kube-scheduler
|
|
||||||
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-scheduler
|
|
||||||
ExecStart=/opt/bin/kube-scheduler \
|
|
||||||
--master=127.0.0.1:8080
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
- name: kube-register.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Kubernetes Registration Service
|
|
||||||
Documentation=https://github.com/kelseyhightower/kube-register
|
|
||||||
Requires=kube-apiserver.service fleet.service
|
|
||||||
After=kube-apiserver.service fleet.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=-/usr/bin/wget -nc -O /opt/bin/kube-register https://github.com/kelseyhightower/kube-register/releases/download/v0.0.4/kube-register-0.0.4-linux-amd64
|
|
||||||
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-register
|
|
||||||
ExecStart=/opt/bin/kube-register \
|
|
||||||
--metadata=k8srole=node \
|
|
||||||
--fleet-endpoint=unix:///var/run/fleet.sock \
|
|
||||||
--api-endpoint=http://127.0.0.1:8080
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
update:
|
|
||||||
group: alpha
|
|
||||||
reboot-strategy: off
|
|
@ -1,81 +0,0 @@
|
|||||||
#cloud-config
|
|
||||||
|
|
||||||
write_files:
|
|
||||||
- path: /opt/bin/wupiao
|
|
||||||
owner: root
|
|
||||||
permissions: 0755
|
|
||||||
content: |
|
|
||||||
#!/bin/bash
|
|
||||||
# [w]ait [u]ntil [p]ort [i]s [a]ctually [o]pen
|
|
||||||
[ -n "$1" ] && [ -n "$2" ] && while ! curl --output /dev/null \
|
|
||||||
--silent --head --fail \
|
|
||||||
http://${1}:${2}; do sleep 1 && echo -n .; done;
|
|
||||||
exit $?
|
|
||||||
|
|
||||||
coreos:
|
|
||||||
etcd2:
|
|
||||||
listen-client-urls: http://localhost:2379
|
|
||||||
advertise-client-urls: http://0.0.0.0:2379
|
|
||||||
initial-cluster: master=http://<master-private-ip>:2380
|
|
||||||
proxy: on
|
|
||||||
fleet:
|
|
||||||
etcd_servers: http://localhost:2379
|
|
||||||
metadata: k8srole=node
|
|
||||||
flannel:
|
|
||||||
etcd_endpoints: http://localhost:2379
|
|
||||||
locksmithd:
|
|
||||||
endpoint: http://localhost:2379
|
|
||||||
units:
|
|
||||||
- name: etcd2.service
|
|
||||||
command: start
|
|
||||||
- name: fleet.service
|
|
||||||
command: start
|
|
||||||
- name: flanneld.service
|
|
||||||
command: start
|
|
||||||
- name: docker.service
|
|
||||||
command: start
|
|
||||||
drop-ins:
|
|
||||||
- name: 50-docker-mirror.conf
|
|
||||||
content: |
|
|
||||||
[Service]
|
|
||||||
Environment=DOCKER_OPTS='--registry-mirror=http://<master-private-ip>:5000'
|
|
||||||
- name: kubelet.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Kubernetes Kubelet
|
|
||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
||||||
Requires=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubelet
|
|
||||||
ExecStartPre=/usr/bin/chmod +x /opt/bin/kubelet
|
|
||||||
# wait for kubernetes master to be up and ready
|
|
||||||
ExecStartPre=/opt/bin/wupiao <master-private-ip> 8080
|
|
||||||
ExecStart=/opt/bin/kubelet \
|
|
||||||
--api-servers=<master-private-ip>:8080 \
|
|
||||||
--hostname-override=$private_ipv4
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
- name: kube-proxy.service
|
|
||||||
command: start
|
|
||||||
content: |
|
|
||||||
[Unit]
|
|
||||||
Description=Kubernetes Proxy
|
|
||||||
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
|
|
||||||
Requires=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kube-proxy
|
|
||||||
ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-proxy
|
|
||||||
# wait for kubernetes master to be up and ready
|
|
||||||
ExecStartPre=/opt/bin/wupiao <master-private-ip> 8080
|
|
||||||
ExecStart=/opt/bin/kube-proxy \
|
|
||||||
--master=http://<master-private-ip>:8080
|
|
||||||
Restart=always
|
|
||||||
RestartSec=10
|
|
||||||
update:
|
|
||||||
group: alpha
|
|
||||||
reboot-strategy: off
|
|
@ -1,421 +0,0 @@
|
|||||||
{
|
|
||||||
"AWSTemplateFormatVersion": "2010-09-09",
|
|
||||||
"Description": "Kubernetes 0.19.3 on EC2 powered by CoreOS 681.2.0 (stable)",
|
|
||||||
"Mappings": {
|
|
||||||
"RegionMap": {
|
|
||||||
"eu-central-1" : {
|
|
||||||
"AMI" : "ami-eae5ddf7"
|
|
||||||
},
|
|
||||||
"ap-northeast-1" : {
|
|
||||||
"AMI" : "ami-1a6fca1a"
|
|
||||||
},
|
|
||||||
"us-gov-west-1" : {
|
|
||||||
"AMI" : "ami-e99fffca"
|
|
||||||
},
|
|
||||||
"sa-east-1" : {
|
|
||||||
"AMI" : "ami-b1cb49ac"
|
|
||||||
},
|
|
||||||
"ap-southeast-2" : {
|
|
||||||
"AMI" : "ami-23641e19"
|
|
||||||
},
|
|
||||||
"ap-southeast-1" : {
|
|
||||||
"AMI" : "ami-da030788"
|
|
||||||
},
|
|
||||||
"us-east-1" : {
|
|
||||||
"AMI" : "ami-93ea17f8"
|
|
||||||
},
|
|
||||||
"us-west-2" : {
|
|
||||||
"AMI" : "ami-5d4d486d"
|
|
||||||
},
|
|
||||||
"us-west-1" : {
|
|
||||||
"AMI" : "ami-c967938d"
|
|
||||||
},
|
|
||||||
"eu-west-1" : {
|
|
||||||
"AMI" : "ami-5f2f5528"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Parameters": {
|
|
||||||
"InstanceType": {
|
|
||||||
"Description": "EC2 HVM instance type (m3.medium, etc).",
|
|
||||||
"Type": "String",
|
|
||||||
"Default": "m3.medium",
|
|
||||||
"AllowedValues": [
|
|
||||||
"m3.medium",
|
|
||||||
"m3.large",
|
|
||||||
"m3.xlarge",
|
|
||||||
"m3.2xlarge",
|
|
||||||
"c3.large",
|
|
||||||
"c3.xlarge",
|
|
||||||
"c3.2xlarge",
|
|
||||||
"c3.4xlarge",
|
|
||||||
"c3.8xlarge",
|
|
||||||
"cc2.8xlarge",
|
|
||||||
"cr1.8xlarge",
|
|
||||||
"hi1.4xlarge",
|
|
||||||
"hs1.8xlarge",
|
|
||||||
"i2.xlarge",
|
|
||||||
"i2.2xlarge",
|
|
||||||
"i2.4xlarge",
|
|
||||||
"i2.8xlarge",
|
|
||||||
"r3.large",
|
|
||||||
"r3.xlarge",
|
|
||||||
"r3.2xlarge",
|
|
||||||
"r3.4xlarge",
|
|
||||||
"r3.8xlarge",
|
|
||||||
"t2.micro",
|
|
||||||
"t2.small",
|
|
||||||
"t2.medium"
|
|
||||||
],
|
|
||||||
"ConstraintDescription": "Must be a valid EC2 HVM instance type."
|
|
||||||
},
|
|
||||||
"ClusterSize": {
|
|
||||||
"Description": "Number of nodes in cluster (2-12).",
|
|
||||||
"Default": "2",
|
|
||||||
"MinValue": "2",
|
|
||||||
"MaxValue": "12",
|
|
||||||
"Type": "Number"
|
|
||||||
},
|
|
||||||
"AllowSSHFrom": {
|
|
||||||
"Description": "The net block (CIDR) that SSH is available to.",
|
|
||||||
"Default": "0.0.0.0/0",
|
|
||||||
"Type": "String"
|
|
||||||
},
|
|
||||||
"KeyPair": {
|
|
||||||
"Description": "The name of an EC2 Key Pair to allow SSH access to the instance.",
|
|
||||||
"Type": "AWS::EC2::KeyPair::KeyName"
|
|
||||||
},
|
|
||||||
"VpcId": {
|
|
||||||
"Description": "The ID of the VPC to launch into.",
|
|
||||||
"Type": "AWS::EC2::VPC::Id"
|
|
||||||
},
|
|
||||||
"SubnetId": {
|
|
||||||
"Description": "The ID of the subnet to launch into (that must be within the supplied VPC)",
|
|
||||||
"Type": "AWS::EC2::Subnet::Id"
|
|
||||||
},
|
|
||||||
"SubnetAZ": {
|
|
||||||
"Description": "The availability zone of the subnet supplied (for example eu-west-1a)",
|
|
||||||
"Type": "String"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Conditions": {
|
|
||||||
"UseEC2Classic": {"Fn::Equals": [{"Ref": "VpcId"}, ""]}
|
|
||||||
},
|
|
||||||
"Resources": {
|
|
||||||
"KubernetesSecurityGroup": {
|
|
||||||
"Type": "AWS::EC2::SecurityGroup",
|
|
||||||
"Properties": {
|
|
||||||
"VpcId": {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, {"Ref": "VpcId"}]},
|
|
||||||
"GroupDescription": "Kubernetes SecurityGroup",
|
|
||||||
"SecurityGroupIngress": [
|
|
||||||
{
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "22",
|
|
||||||
"ToPort": "22",
|
|
||||||
"CidrIp": {"Ref": "AllowSSHFrom"}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"KubernetesIngress": {
|
|
||||||
"Type": "AWS::EC2::SecurityGroupIngress",
|
|
||||||
"Properties": {
|
|
||||||
"GroupId": {"Fn::GetAtt": ["KubernetesSecurityGroup", "GroupId"]},
|
|
||||||
"IpProtocol": "tcp",
|
|
||||||
"FromPort": "1",
|
|
||||||
"ToPort": "65535",
|
|
||||||
"SourceSecurityGroupId": {
|
|
||||||
"Fn::GetAtt" : [ "KubernetesSecurityGroup", "GroupId" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"KubernetesIngressUDP": {
|
|
||||||
"Type": "AWS::EC2::SecurityGroupIngress",
|
|
||||||
"Properties": {
|
|
||||||
"GroupId": {"Fn::GetAtt": ["KubernetesSecurityGroup", "GroupId"]},
|
|
||||||
"IpProtocol": "udp",
|
|
||||||
"FromPort": "1",
|
|
||||||
"ToPort": "65535",
|
|
||||||
"SourceSecurityGroupId": {
|
|
||||||
"Fn::GetAtt" : [ "KubernetesSecurityGroup", "GroupId" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"KubernetesMasterInstance": {
|
|
||||||
"Type": "AWS::EC2::Instance",
|
|
||||||
"Properties": {
|
|
||||||
"NetworkInterfaces" : [{
|
|
||||||
"GroupSet" : [{"Fn::GetAtt": ["KubernetesSecurityGroup", "GroupId"]}],
|
|
||||||
"AssociatePublicIpAddress" : "true",
|
|
||||||
"DeviceIndex" : "0",
|
|
||||||
"DeleteOnTermination" : "true",
|
|
||||||
"SubnetId" : {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, {"Ref": "SubnetId"}]}
|
|
||||||
}],
|
|
||||||
"ImageId": {"Fn::FindInMap" : ["RegionMap", {"Ref": "AWS::Region" }, "AMI"]},
|
|
||||||
"InstanceType": {"Ref": "InstanceType"},
|
|
||||||
"KeyName": {"Ref": "KeyPair"},
|
|
||||||
"Tags" : [
|
|
||||||
{"Key" : "Name", "Value" : {"Fn::Join" : [ "-", [ {"Ref" : "AWS::StackName"}, "k8s-master" ] ]}},
|
|
||||||
{"Key" : "KubernetesRole", "Value" : "node"}
|
|
||||||
],
|
|
||||||
"UserData": { "Fn::Base64": {"Fn::Join" : ["", [
|
|
||||||
"#cloud-config\n\n",
|
|
||||||
"write_files:\n",
|
|
||||||
"- path: /opt/bin/waiter.sh\n",
|
|
||||||
" owner: root\n",
|
|
||||||
" content: |\n",
|
|
||||||
" #! /usr/bin/bash\n",
|
|
||||||
" until curl http://127.0.0.1:2379/v2/machines; do sleep 2; done\n",
|
|
||||||
"coreos:\n",
|
|
||||||
" etcd2:\n",
|
|
||||||
" name: master\n",
|
|
||||||
" initial-cluster-token: k8s_etcd\n",
|
|
||||||
" initial-cluster: master=http://$private_ipv4:2380\n",
|
|
||||||
" listen-peer-urls: http://$private_ipv4:2380,http://localhost:2380\n",
|
|
||||||
" initial-advertise-peer-urls: http://$private_ipv4:2380\n",
|
|
||||||
" listen-client-urls: http://$private_ipv4:2379,http://localhost:2379\n",
|
|
||||||
" advertise-client-urls: http://$private_ipv4:2379\n",
|
|
||||||
" fleet:\n",
|
|
||||||
" etcd_servers: http://localhost:2379\n",
|
|
||||||
" metadata: k8srole=master\n",
|
|
||||||
" flannel:\n",
|
|
||||||
" etcd_endpoints: http://localhost:2379\n",
|
|
||||||
" locksmithd:\n",
|
|
||||||
" endpoint: http://localhost:2379\n",
|
|
||||||
" units:\n",
|
|
||||||
" - name: etcd2.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" - name: fleet.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" - name: etcd2-waiter.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=etcd waiter\n",
|
|
||||||
" Wants=network-online.target\n",
|
|
||||||
" Wants=etcd2.service\n",
|
|
||||||
" After=etcd2.service\n",
|
|
||||||
" After=network-online.target\n",
|
|
||||||
" Before=flanneld.service fleet.service locksmithd.service\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStart=/usr/bin/bash /opt/bin/waiter.sh\n",
|
|
||||||
" RemainAfterExit=true\n",
|
|
||||||
" Type=oneshot\n",
|
|
||||||
" - name: flanneld.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" drop-ins:\n",
|
|
||||||
" - name: 50-network-config.conf\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=-/usr/bin/etcdctl mk /coreos.com/network/config '{\"Network\": \"10.244.0.0/16\", \"Backend\": {\"Type\": \"vxlan\"}}'\n",
|
|
||||||
" - name: docker-cache.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Docker cache proxy\n",
|
|
||||||
" Requires=early-docker.service\n",
|
|
||||||
" After=early-docker.service\n",
|
|
||||||
" Before=early-docker.target\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" TimeoutStartSec=0\n",
|
|
||||||
" RestartSec=5\n",
|
|
||||||
" Environment=TMPDIR=/var/tmp/\n",
|
|
||||||
" Environment=DOCKER_HOST=unix:///var/run/early-docker.sock\n",
|
|
||||||
" ExecStartPre=-/usr/bin/docker kill docker-registry\n",
|
|
||||||
" ExecStartPre=-/usr/bin/docker rm docker-registry\n",
|
|
||||||
" ExecStartPre=/usr/bin/docker pull quay.io/devops/docker-registry:latest\n",
|
|
||||||
" # GUNICORN_OPTS is an workaround for\n",
|
|
||||||
" # https://github.com/docker/docker-registry/issues/892\n",
|
|
||||||
" ExecStart=/usr/bin/docker run --rm --net host --name docker-registry \\\n",
|
|
||||||
" -e STANDALONE=false \\\n",
|
|
||||||
" -e GUNICORN_OPTS=[--preload] \\\n",
|
|
||||||
" -e MIRROR_SOURCE=https://registry-1.docker.io \\\n",
|
|
||||||
" -e MIRROR_SOURCE_INDEX=https://index.docker.io \\\n",
|
|
||||||
" -e MIRROR_TAGS_CACHE_TTL=1800 \\\n",
|
|
||||||
" quay.io/devops/docker-registry:latest\n",
|
|
||||||
" - name: get-kubectl.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Get kubectl client tool\n",
|
|
||||||
" Documentation=https://github.com/GoogleCloudPlatform/kubernetes\n",
|
|
||||||
" Requires=network-online.target\n",
|
|
||||||
" After=network-online.target\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStart=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.3/bin/linux/amd64/kubectl\n",
|
|
||||||
" ExecStart=/usr/bin/chmod +x /opt/bin/kubectl\n",
|
|
||||||
" Type=oneshot\n",
|
|
||||||
" RemainAfterExit=true\n",
|
|
||||||
" - name: kube-apiserver.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Kubernetes API Server\n",
|
|
||||||
" Documentation=https://github.com/GoogleCloudPlatform/kubernetes\n",
|
|
||||||
" Requires=etcd2-waiter.service\n",
|
|
||||||
" After=etcd2-waiter.service\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.3/bin/linux/amd64/kube-apiserver\n",
|
|
||||||
" ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-apiserver\n",
|
|
||||||
" ExecStart=/opt/bin/kube-apiserver \\\n",
|
|
||||||
" --insecure-bind-address=0.0.0.0 \\\n",
|
|
||||||
" --service-cluster-ip-range=10.100.0.0/16 \\\n",
|
|
||||||
" --etcd-servers=http://localhost:2379\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" RestartSec=10\n",
|
|
||||||
" - name: kube-controller-manager.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Kubernetes Controller Manager\n",
|
|
||||||
" Documentation=https://github.com/GoogleCloudPlatform/kubernetes\n",
|
|
||||||
" Requires=kube-apiserver.service\n",
|
|
||||||
" After=kube-apiserver.service\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v1.0.3/bin/linux/amd64/kube-controller-manager\n",
|
|
||||||
" ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-controller-manager\n",
|
|
||||||
" ExecStart=/opt/bin/kube-controller-manager \\\n",
|
|
||||||
" --master=127.0.0.1:8080\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" RestartSec=10\n",
|
|
||||||
" - name: kube-scheduler.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Kubernetes Scheduler\n",
|
|
||||||
" Documentation=https://github.com/GoogleCloudPlatform/kubernetes\n",
|
|
||||||
" Requires=kube-apiserver.service\n",
|
|
||||||
" After=kube-apiserver.service\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v0.19.3/bin/linux/amd64/kube-scheduler\n",
|
|
||||||
" ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-scheduler\n",
|
|
||||||
" ExecStart=/opt/bin/kube-scheduler \\\n",
|
|
||||||
" --master=127.0.0.1:8080\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" RestartSec=10\n",
|
|
||||||
" - name: kube-register.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Kubernetes Registration Service\n",
|
|
||||||
" Documentation=https://github.com/kelseyhightower/kube-register\n",
|
|
||||||
" Requires=kube-apiserver.service fleet.service\n",
|
|
||||||
" After=kube-apiserver.service fleet.service\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=-/usr/bin/wget -nc -O /opt/bin/kube-register https://github.com/kelseyhightower/kube-register/releases/download/v0.0.4/kube-register-0.0.4-linux-amd64\n",
|
|
||||||
" ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-register\n",
|
|
||||||
" ExecStart=/opt/bin/kube-register \\\n",
|
|
||||||
" --metadata=k8srole=node \\\n",
|
|
||||||
" --fleet-endpoint=unix:///var/run/fleet.sock \\\n",
|
|
||||||
" --api-endpoint=http://127.0.0.1:8080\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" RestartSec=10\n",
|
|
||||||
" update:\n",
|
|
||||||
" group: alpha\n",
|
|
||||||
" reboot-strategy: off\n"
|
|
||||||
]]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"KubernetesNodeLaunchConfig": {
|
|
||||||
"Type": "AWS::AutoScaling::LaunchConfiguration",
|
|
||||||
"Properties": {
|
|
||||||
"ImageId": {"Fn::FindInMap" : ["RegionMap", {"Ref": "AWS::Region" }, "AMI" ]},
|
|
||||||
"InstanceType": {"Ref": "InstanceType"},
|
|
||||||
"KeyName": {"Ref": "KeyPair"},
|
|
||||||
"AssociatePublicIpAddress" : "true",
|
|
||||||
"SecurityGroups": [{"Fn::If": [
|
|
||||||
"UseEC2Classic",
|
|
||||||
{"Ref": "KubernetesSecurityGroup"},
|
|
||||||
{"Fn::GetAtt": ["KubernetesSecurityGroup", "GroupId"]}]
|
|
||||||
}],
|
|
||||||
"UserData": { "Fn::Base64": {"Fn::Join" : ["", [
|
|
||||||
"#cloud-config\n\n",
|
|
||||||
"coreos:\n",
|
|
||||||
" etcd2:\n",
|
|
||||||
" listen-client-urls: http://localhost:2379\n",
|
|
||||||
" initial-cluster: master=http://", {"Fn::GetAtt" :["KubernetesMasterInstance" , "PrivateIp"]}, ":2380\n",
|
|
||||||
" proxy: on\n",
|
|
||||||
" fleet:\n",
|
|
||||||
" etcd_servers: http://localhost:2379\n",
|
|
||||||
" metadata: k8srole=node\n",
|
|
||||||
" flannel:\n",
|
|
||||||
" etcd_endpoints: http://localhost:2379\n",
|
|
||||||
" locksmithd:\n",
|
|
||||||
" endpoint: http://localhost:2379\n",
|
|
||||||
" units:\n",
|
|
||||||
" - name: etcd2.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" - name: fleet.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" - name: flanneld.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" - name: docker.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" drop-ins:\n",
|
|
||||||
" - name: 50-docker-mirror.conf\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" Environment=DOCKER_OPTS='--registry-mirror=http://", {"Fn::GetAtt" :["KubernetesMasterInstance" , "PrivateIp"]}, ":5000'\n",
|
|
||||||
" - name: kubelet.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Kubernetes Kubelet\n",
|
|
||||||
" Documentation=https://github.com/GoogleCloudPlatform/kubernetes\n",
|
|
||||||
" Requires=network-online.target\n",
|
|
||||||
" After=network-online.target\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v0.19.3/bin/linux/amd64/kubelet\n",
|
|
||||||
" ExecStartPre=/usr/bin/chmod +x /opt/bin/kubelet\n",
|
|
||||||
" ExecStart=/opt/bin/kubelet \\\n",
|
|
||||||
" --api-servers=", {"Fn::GetAtt" :["KubernetesMasterInstance" , "PrivateIp"]}, ":8080 \\\n",
|
|
||||||
" --hostname-override=$private_ipv4\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" RestartSec=10\n",
|
|
||||||
" - name: kube-proxy.service\n",
|
|
||||||
" command: start\n",
|
|
||||||
" content: |\n",
|
|
||||||
" [Unit]\n",
|
|
||||||
" Description=Kubernetes Proxy\n",
|
|
||||||
" Documentation=https://github.com/GoogleCloudPlatform/kubernetes\n",
|
|
||||||
" Requires=network-online.target\n",
|
|
||||||
" After=network-online.target\n\n",
|
|
||||||
" [Service]\n",
|
|
||||||
" ExecStartPre=/usr/bin/wget -N -P /opt/bin https://storage.googleapis.com/kubernetes-release/release/v0.19.3/bin/linux/amd64/kube-proxy\n",
|
|
||||||
" ExecStartPre=/usr/bin/chmod +x /opt/bin/kube-proxy\n",
|
|
||||||
" ExecStart=/opt/bin/kube-proxy \\\n",
|
|
||||||
" --master=http://", {"Fn::GetAtt" :["KubernetesMasterInstance" , "PrivateIp"]}, ":8080\n",
|
|
||||||
" Restart=always\n",
|
|
||||||
" RestartSec=10\n",
|
|
||||||
" update:\n",
|
|
||||||
" group: alpha\n",
|
|
||||||
" reboot-strategy: off\n"
|
|
||||||
]]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"KubernetesAutoScalingGroup": {
|
|
||||||
"Type": "AWS::AutoScaling::AutoScalingGroup",
|
|
||||||
"Properties": {
|
|
||||||
"AvailabilityZones": {"Fn::If": ["UseEC2Classic", {"Fn::GetAZs": ""}, [{"Ref": "SubnetAZ"}]]},
|
|
||||||
"VPCZoneIdentifier": {"Fn::If": ["UseEC2Classic", {"Ref": "AWS::NoValue"}, [{"Ref": "SubnetId"}]]},
|
|
||||||
"LaunchConfigurationName": {"Ref": "KubernetesNodeLaunchConfig"},
|
|
||||||
"MinSize": "2",
|
|
||||||
"MaxSize": "12",
|
|
||||||
"DesiredCapacity": {"Ref": "ClusterSize"},
|
|
||||||
"Tags" : [
|
|
||||||
{"Key" : "Name", "Value" : {"Fn::Join" : [ "-", [ {"Ref" : "AWS::StackName"}, "k8s-node" ] ]}, "PropagateAtLaunch" : true},
|
|
||||||
{"Key" : "KubernetesRole", "Value" : "node", "PropagateAtLaunch" : true}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Outputs": {
|
|
||||||
"KubernetesMasterPublicIp": {
|
|
||||||
"Description": "Public Ip of the newly created Kubernetes Master instance",
|
|
||||||
"Value": {"Fn::GetAtt": ["KubernetesMasterInstance" , "PublicIp"]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
|
|
||||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
|
||||||
|
|
||||||
If you are using a released version of Kubernetes, you should
|
|
||||||
refer to the docs that go with that version.
|
|
||||||
|
|
||||||
<strong>
|
|
||||||
The latest 1.0.x release of this document can be found
|
|
||||||
[here](http://releases.k8s.io/release-1.0/docs/getting-started-guides/aws/kubectl.md).
|
|
||||||
|
|
||||||
Documentation for other releases can be found at
|
|
||||||
[releases.k8s.io](http://releases.k8s.io).
|
|
||||||
</strong>
|
|
||||||
--
|
|
||||||
|
|
||||||
<!-- END STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
# Install and configure kubectl
|
|
||||||
|
|
||||||
## Download the kubectl CLI tool
|
|
||||||
|
|
||||||
```bash
|
|
||||||
### Darwin
|
|
||||||
wget https://storage.googleapis.com/kubernetes-release/release/v0.19.3/bin/darwin/amd64/kubectl
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
wget https://storage.googleapis.com/kubernetes-release/release/v0.19.3/bin/linux/amd64/kubectl
|
|
||||||
```
|
|
||||||
|
|
||||||
### Copy kubectl to your path
|
|
||||||
|
|
||||||
```bash
|
|
||||||
chmod +x kubectl
|
|
||||||
mv kubectl /usr/local/bin/
|
|
||||||
```
|
|
||||||
|
|
||||||
### Create a secure tunnel for API communication
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ssh -f -nNT -L 8080:127.0.0.1:8080 core@<master-public-ip>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
|
||||||
[]()
|
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
|
@ -38,8 +38,7 @@ There are multiple guides on running Kubernetes with [CoreOS](http://coreos.com)
|
|||||||
* [Multi-node Cluster](coreos/coreos_multinode_cluster.md)
|
* [Multi-node Cluster](coreos/coreos_multinode_cluster.md)
|
||||||
* [Setup Multi-node Cluster on Google Compute Engine in an easy way](https://github.com/rimusz/coreos-multi-node-k8s-gce/blob/master/README.md)
|
* [Setup Multi-node Cluster on Google Compute Engine in an easy way](https://github.com/rimusz/coreos-multi-node-k8s-gce/blob/master/README.md)
|
||||||
* [Multi-node cluster using cloud-config and Weave on Vagrant](https://github.com/errordeveloper/weave-demos/blob/master/poseidon/README.md)
|
* [Multi-node cluster using cloud-config and Weave on Vagrant](https://github.com/errordeveloper/weave-demos/blob/master/poseidon/README.md)
|
||||||
* [Multi-node cluster using cloud-config and Vagrant](https://github.com/pires/kubernetes-vagrant-coreos-cluster/blob/master/README.md)
|
* [Multi-node cluster using cloud-config and Vagrant (supports VirtualBox, Parallels and VMware)](https://github.com/pires/kubernetes-vagrant-coreos-cluster/blob/master/README.md)
|
||||||
* [Yet another multi-node cluster using cloud-config and Vagrant](https://github.com/AntonioMeireles/kubernetes-vagrant-coreos-cluster/blob/master/README.md) (similar to the one above but with an increased, more *aggressive* focus on features and flexibility)
|
|
||||||
* [Multi-node cluster with Vagrant and fleet units using a small OS X App](https://github.com/rimusz/coreos-osx-gui-kubernetes-cluster/blob/master/README.md)
|
* [Multi-node cluster with Vagrant and fleet units using a small OS X App](https://github.com/rimusz/coreos-osx-gui-kubernetes-cluster/blob/master/README.md)
|
||||||
* [Resizable multi-node cluster on Azure with Weave](coreos/azure/README.md)
|
* [Resizable multi-node cluster on Azure with Weave](coreos/azure/README.md)
|
||||||
* [Multi-node cluster using cloud-config, coreos and VMware ESXi](https://github.com/xavierbaude/VMware-coreos-multi-nodes-Kubernetes)
|
* [Multi-node cluster using cloud-config, coreos and VMware ESXi](https://github.com/xavierbaude/VMware-coreos-multi-nodes-Kubernetes)
|
||||||
|
@ -161,7 +161,7 @@ nova list
|
|||||||
|
|
||||||
#### Get a Suitable CoreOS Image
|
#### Get a Suitable CoreOS Image
|
||||||
|
|
||||||
You'll need a [suitable version of CoreOS image for OpenStack] (https://coreos.com/os/docs/latest/booting-on-openstack.html)
|
You'll need a [suitable version of CoreOS image for OpenStack](https://coreos.com/os/docs/latest/booting-on-openstack.html)
|
||||||
Once you download that, upload it to glance. An example is shown below:
|
Once you download that, upload it to glance. An example is shown below:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -229,39 +229,6 @@ minion01
|
|||||||
|
|
||||||
This is basically the same as the master nodes but with the node.yaml post-boot script instead of the master.
|
This is basically the same as the master nodes but with the node.yaml post-boot script instead of the master.
|
||||||
|
|
||||||
### VMware Fusion
|
|
||||||
|
|
||||||
#### Create the master config-drive
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mkdir -p /tmp/new-drive/openstack/latest/
|
|
||||||
cp master.yaml /tmp/new-drive/openstack/latest/user_data
|
|
||||||
hdiutil makehybrid -iso -joliet -joliet-volume-name "config-2" -joliet -o master.iso /tmp/new-drive
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Provision the Master
|
|
||||||
|
|
||||||
Boot the [vmware image](https://coreos.com/docs/running-coreos/platforms/vmware) using `master.iso` as a config drive.
|
|
||||||
|
|
||||||
#### Capture the master private IP address
|
|
||||||
|
|
||||||
#### Edit node.yaml
|
|
||||||
|
|
||||||
Edit `node.yaml` and replace all instances of `<master-private-ip>` with the private IP address of the master node.
|
|
||||||
|
|
||||||
#### Create the node config-drive
|
|
||||||
|
|
||||||
```sh
|
|
||||||
mkdir -p /tmp/new-drive/openstack/latest/
|
|
||||||
cp node.yaml /tmp/new-drive/openstack/latest/user_data
|
|
||||||
hdiutil makehybrid -iso -joliet -joliet-volume-name "config-2" -joliet -o node.iso /tmp/new-drive
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Provision worker nodes
|
|
||||||
|
|
||||||
Boot one or more the [vmware image](https://coreos.com/docs/running-coreos/platforms/vmware) using `node.iso` as a config drive.
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
[]()
|
[]()
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
||||||
|
Loading…
Reference in New Issue
Block a user