mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-18 03:30:07 -03:30
Notes About Server In admin.conf (#6854)
* Add note about changing private IP in admin.conf. When I run kubespray, a load balancer is created which should be used instead of the ip of the controller node. * Procedure to find load balancer and update admin.conf When I run kubespray, a load balancer is used instead of the private ip of the controller.
This commit is contained in:
@@ -49,7 +49,10 @@ ansible-playbook -i ./inventory/hosts ./cluster.yml -e ansible_user=ubuntu -b --
|
||||
If you want to use another distribution than Ubuntu 18.04 (Bionic) LTS, you can modify the search filters of the 'data "aws_ami" "distro"' in variables.tf.
|
||||
|
||||
For example, to use:
|
||||
|
||||
- Debian Jessie, replace 'data "aws_ami" "distro"' in variables.tf with
|
||||
|
||||
```
|
||||
data "aws_ami" "distro" {
|
||||
most_recent = true
|
||||
|
||||
@@ -65,8 +68,11 @@ data "aws_ami" "distro" {
|
||||
|
||||
owners = ["379101102735"]
|
||||
}
|
||||
```
|
||||
|
||||
- Ubuntu 16.04, replace 'data "aws_ami" "distro"' in variables.tf with
|
||||
|
||||
```
|
||||
data "aws_ami" "distro" {
|
||||
most_recent = true
|
||||
|
||||
@@ -82,8 +88,11 @@ data "aws_ami" "distro" {
|
||||
|
||||
owners = ["099720109477"]
|
||||
}
|
||||
```
|
||||
|
||||
- Centos 7, replace 'data "aws_ami" "distro"' in variables.tf with
|
||||
|
||||
```
|
||||
data "aws_ami" "distro" {
|
||||
most_recent = true
|
||||
|
||||
@@ -99,6 +108,31 @@ data "aws_ami" "distro" {
|
||||
|
||||
owners = ["688023202711"]
|
||||
}
|
||||
```
|
||||
|
||||
## Connecting to Kubernetes
|
||||
|
||||
You can use the following set of commands to get the kubeconfig file from your newly created cluster. Before running the commands, make sure you are in the project's root folder.
|
||||
|
||||
```
|
||||
# Get the controller's IP address.
|
||||
CONTROLLER_HOST_NAME=$(cat ./inventory/hosts | grep "\[kube-master\]" -A 1 | tail -n 1)
|
||||
CONTROLLER_IP=$(cat ./inventory/hosts | grep $CONTROLLER_HOST_NAME | grep ansible_host | cut -d'=' -f2)
|
||||
|
||||
# Get the hostname of the load balancer.
|
||||
LB_HOST=$(cat inventory/hosts | grep apiserver_loadbalancer_domain_name | cut -d'"' -f2)
|
||||
|
||||
# Get the controller's SSH fingerprint.
|
||||
ssh-keygen -R $CONTROLLER_IP > /dev/null 2>&1
|
||||
ssh-keyscan -H $CONTROLLER_IP >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
# Get the kubeconfig from the controller.
|
||||
mkdir -p ~/.kube
|
||||
ssh -F ssh-bastion.conf centos@$CONTROLLER_IP "sudo chmod 644 /etc/kubernetes/admin.conf"
|
||||
scp -F ssh-bastion.conf centos@$CONTROLLER_IP:/etc/kubernetes/admin.conf ~/.kube/config
|
||||
sed -i "s^server:.*^server: https://$LB_HOST:6443^" ~/.kube/config
|
||||
kubectl get nodes
|
||||
```
|
||||
|
||||
**Troubleshooting**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user