Skip to content

Instantly share code, notes, and snippets.

@iandow
Created September 6, 2018 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iandow/22c82206dfac90584a192a28aae9d2d4 to your computer and use it in GitHub Desktop.
Save iandow/22c82206dfac90584a192a28aae9d2d4 to your computer and use it in GitHub Desktop.
kube cluster create commands
enmac:kubeflow-codelab idownard$ gcloud config set project mapr-demos
Updated property [core/project].
Updates are available for some Cloud SDK components. To install them,
please run:
$ gcloud components update
enmac:kubeflow-codelab idownard$
enmac:kubeflow-codelab idownard$
enmac:kubeflow-codelab idownard$ gcloud container clusters create kubeflow-codelab --zone us-west1-a --machine-type n1-standard-2
WARNING: Currently node auto repairs are disabled by default. In the future this will change and they will be enabled by default. Use `--[no-]enable-autorepair` flag to suppress this warning.
WARNING: Currently VPC-native is not the default mode during cluster creation. In the future, this will become the default mode and can be disabled using `--no-enable-ip-alias` flag. Use `--[no-]enable-ip-alias` flag to suppress this warning.
WARNING: Starting in Kubernetes v1.10, new clusters will no longer get compute-rw and storage-ro scopes added to what is specified in --scopes (though the latter will remain included in the default --scopes). To use these scopes, add them explicitly to --scopes. To use the new behavior, set container/new_scopes_behavior property (gcloud config set container/new_scopes_behavior true).
Creating cluster kubeflow-codelab...done.
Created [https://container.googleapis.com/v1/projects/mapr-demos/zones/us-west1-a/clusters/kubeflow-codelab].
To inspect the contents of your cluster, go to: https://console.cloud.google.com/kubernetes/workload_/gcloud/us-west1-a/kubeflow-codelab?project=mapr-demos
kubeconfig entry generated for kubeflow-codelab.
NAME LOCATION MASTER_VERSION MASTER_IP MACHINE_TYPE NODE_VERSION NUM_NODES STATUS
kubeflow-codelab us-west1-a 1.9.7-gke.6 35.203.189.104 n1-standard-2 1.9.7-gke.6 3 RUNNING
enmac:kubeflow-codelab idownard$ gcloud container clusters get-credentials kubeflow-codelab --zone us-west1-a
Fetching cluster endpoint and auth data.
kubeconfig entry generated for kubeflow-codelab.
enmac:kubeflow-codelab idownard$ kubectl create clusterrolebinding default-admin --clusterrole=cluster-admin --user=$(gcloud config get-value account)
clusterrolebinding "default-admin" created
enmac:kubeflow-codelab idownard$ ks init ksonnet-kubeflow
INFO Using context 'gke_mapr-demos_us-west1-a_kubeflow-codelab' from the kubeconfig file specified at the environment variable $KUBECONFIG
ERROR Could not create app; directory '/Users/idownard/development/kubeflow-codelab/ksonnet-kubeflow' already exists
enmac:kubeflow-codelab idownard$ rm -rf ksonnet-kubeflow/
enmac:kubeflow-codelab idownard$ ks init ksonnet-kubeflow
INFO Using context 'gke_mapr-demos_us-west1-a_kubeflow-codelab' from the kubeconfig file specified at the environment variable $KUBECONFIG
INFO Creating environment "default" with namespace "default", pointing to cluster at address "https://35.203.189.104"
INFO Generating ksonnet-lib data at path '/Users/idownard/development/kubeflow-codelab/ksonnet-kubeflow/lib/v1.7.0'
INFO ksonnet app successfully created! Next, try creating a component with `ks generate`.
enmac:kubeflow-codelab idownard$ cd ksonnet-kubeflow/
enmac:ksonnet-kubeflow idownard$ ks env add cloud
INFO Using context 'gke_mapr-demos_us-west1-a_kubeflow-codelab' from the kubeconfig file specified at the environment variable $KUBECONFIG
INFO Creating environment "cloud" with namespace "default", pointing to cluster at address "https://35.203.189.104"
enmac:ksonnet-kubeflow idownard$ VERSION=v0.1.0-rc.0
enmac:ksonnet-kubeflow idownard$ ks registry add kubeflow github.com/kubeflow/kubeflow/tree/${VERSION}/kubeflow
enmac:ksonnet-kubeflow idownard$ ks pkg install kubeflow/core@${VERSION}
INFO Retrieved 22 files
enmac:ksonnet-kubeflow idownard$ ks pkg install kubeflow/tf-serving@${VERSION}
INFO Retrieved 4 files
enmac:ksonnet-kubeflow idownard$ ks pkg install kubeflow/tf-job@${VERSION}
INFO Retrieved 5 files
enmac:ksonnet-kubeflow idownard$ ks generate core kubeflow-core --name=kubeflow-core --cloud=gke
INFO Writing component at '/Users/idownard/development/kubeflow-codelab/ksonnet-kubeflow/components/kubeflow-core.jsonnet'
enmac:ksonnet-kubeflow idownard$ ks apply cloud -c kubeflow-core
INFO Updating configmaps default.jupyterhub-config
INFO Creating non-existent configmaps default.jupyterhub-config
INFO Updating services default.tf-hub-0
INFO Creating non-existent services default.tf-hub-0
INFO Updating services default.tf-hub-lb
INFO Creating non-existent services default.tf-hub-lb
INFO Updating rolebindings default.ambassador
INFO Creating non-existent rolebindings default.ambassador
INFO Updating roles default.jupyter-role
INFO Creating non-existent roles default.jupyter-role
INFO Updating serviceaccounts default.jupyter-hub
INFO Creating non-existent serviceaccounts default.jupyter-hub
INFO Updating rolebindings default.jupyter-role
INFO Creating non-existent rolebindings default.jupyter-role
INFO Updating serviceaccounts default.ambassador
INFO Creating non-existent serviceaccounts default.ambassador
INFO Updating configmaps default.tf-job-operator-config
INFO Creating non-existent configmaps default.tf-job-operator-config
INFO Updating serviceaccounts default.tf-job-operator
INFO Creating non-existent serviceaccounts default.tf-job-operator
INFO Updating clusterroles tf-job-operator
INFO Creating non-existent clusterroles tf-job-operator
INFO Updating clusterrolebindings tf-job-operator
INFO Creating non-existent clusterrolebindings tf-job-operator
INFO Updating customresourcedefinitions tfjobs.kubeflow.org
INFO Creating non-existent customresourcedefinitions tfjobs.kubeflow.org
INFO Updating services default.ambassador
INFO Creating non-existent services default.ambassador
INFO Updating services default.ambassador-admin
INFO Creating non-existent services default.ambassador-admin
INFO Updating roles default.ambassador
INFO Creating non-existent roles default.ambassador
INFO Updating services default.k8s-dashboard
INFO Creating non-existent services default.k8s-dashboard
INFO Updating deployments default.tf-job-operator
INFO Creating non-existent deployments default.tf-job-operator
INFO Updating statefulsets default.tf-hub
INFO Creating non-existent statefulsets default.tf-hub
INFO Updating deployments default.ambassador
INFO Creating non-existent deployments default.ambassador
enmac:ksonnet-kubeflow idownard$ ls
app.yaml components environments lib vendor
enmac:ksonnet-kubeflow idownard$ ls -la
total 8
drwxr-xr-x 8 idownard staff 256 Sep 6 11:17 .
drwxr-xr-x 3 idownard staff 96 Sep 6 11:17 ..
drwxr-xr-x 3 idownard staff 96 Sep 6 11:17 .ksonnet
-rw-r--r-- 1 idownard staff 1213 Sep 6 11:17 app.yaml
drwxr-xr-x 4 idownard staff 128 Sep 6 11:17 components
drwxr-xr-x 5 idownard staff 160 Sep 6 11:17 environments
drwxr-xr-x 3 idownard staff 96 Sep 6 11:17 lib
drwxr-xr-x 3 idownard staff 96 Sep 6 11:17 vendor
enmac:ksonnet-kubeflow idownard$ cd ..
enmac:kubeflow-codelab idownard$ ls -la
total 0
drwxr-xr-x 3 idownard staff 96 Sep 6 11:17 .
drwxr-xr-x 127 idownard staff 4064 Aug 31 22:34 ..
drwxr-xr-x 8 idownard staff 256 Sep 6 11:17 ksonnet-kubeflow
enmac:kubeflow-codelab idownard$ ls
ksonnet-kubeflow
enmac:kubeflow-codelab idownard$ wget http://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-namespace.yaml
--2018-09-06 11:18:26-- http://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-namespace.yaml
Resolving package.mapr.com (package.mapr.com)... 13.35.121.114, 13.35.121.26, 13.35.121.66, ...
Connecting to package.mapr.com (package.mapr.com)|13.35.121.114|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-namespace.yaml [following]
--2018-09-06 11:18:27-- https://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-namespace.yaml
Connecting to package.mapr.com (package.mapr.com)|13.35.121.114|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 93 [text/plain]
Saving to: ‘kdf-namespace.yaml’
kdf-namespace.yaml 100%[==================================================================================================>] 93 --.-KB/s in 0s
2018-09-06 11:18:27 (3.41 MB/s) - ‘kdf-namespace.yaml’ saved [93/93]
enmac:kubeflow-codelab idownard$ kubectl create -f kdf-namespace.yaml
namespace "mapr-system" created
enmac:kubeflow-codelab idownard$ kubectl get namespaces
NAME STATUS AGE
default Active 3m
kube-public Active 3m
kube-system Active 3m
mapr-system Active 3s
enmac:kubeflow-codelab idownard$ wget http://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-rbac.yaml
--2018-09-06 11:18:36-- http://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-rbac.yaml
Resolving package.mapr.com (package.mapr.com)... 13.35.121.26, 13.35.121.66, 13.35.121.64, ...
Connecting to package.mapr.com (package.mapr.com)|13.35.121.26|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-rbac.yaml [following]
--2018-09-06 11:18:36-- https://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-rbac.yaml
Connecting to package.mapr.com (package.mapr.com)|13.35.121.26|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1137 (1.1K) [text/plain]
Saving to: ‘kdf-rbac.yaml’
kdf-rbac.yaml 100%[==================================================================================================>] 1.11K --.-KB/s in 0s
2018-09-06 11:18:36 (14.7 MB/s) - ‘kdf-rbac.yaml’ saved [1137/1137]
enmac:kubeflow-codelab idownard$ kubectl create -f kdf-rbac.yaml
serviceaccount "maprkdf" created
clusterrole "mapr:kdf" created
clusterrolebinding "mapr:kdf" created
enmac:kubeflow-codelab idownard$ kubectl get clusterroles --namespace mapr-system | grep mapr
mapr:kdf 3s
enmac:kubeflow-codelab idownard$ wget -q -O- http://package.mapr.com/tools/KubernetesDataFabric/v1.0.2/kdf-plugin-gke.yaml | sed 's/changeme!/'`kubectl config view --minify | grep server | cut -f 3 -d "/"`'/g' > kdf-plugin-gke.yaml
enmac:kubeflow-codelab idownard$ kubectl create -f kdf-plugin-gke.yaml
daemonset "mapr-kdfplugin" created
enmac:kubeflow-codelab idownard$ kubectl get pods --all-namespaces | grep mapr
mapr-system mapr-kdfplugin-cs2fx 0/1 ContainerCreating 0 3s
mapr-system mapr-kdfplugin-ljtrk 0/1 ContainerCreating 0 3s
mapr-system mapr-kdfplugin-xc7tl 0/1 ContainerCreating 0 3s
enmac:kubeflow-codelab idownard$ ls -la
total 24
drwxr-xr-x 6 idownard staff 192 Sep 6 11:18 .
drwxr-xr-x 127 idownard staff 4064 Aug 31 22:34 ..
-rw-r--r--@ 1 idownard staff 93 Jul 9 10:30 kdf-namespace.yaml
-rw-r--r-- 1 idownard staff 1679 Sep 6 11:18 kdf-plugin-gke.yaml
-rw-r--r--@ 1 idownard staff 1137 Jul 9 10:30 kdf-rbac.yaml
drwxr-xr-x 8 idownard staff 256 Sep 6 11:17 ksonnet-kubeflow
enmac:kubeflow-codelab idownard$ kubectl config
Modify kubeconfig files using subcommands like "kubectl config set current-context my-context"
The loading order follows these rules:
1. If the --kubeconfig flag is set, then only that file is loaded. The flag may only be set once and no merging takes
place.
2. If $KUBECONFIG environment variable is set, then it is used a list of paths (normal path delimitting rules for your
system). These paths are merged. When a value is modified, it is modified in the file that defines the stanza. When a
value is created, it is created in the first file that exists. If no files in the chain exist, then it creates the last
file in the list.
3. Otherwise, ${HOME}/.kube/config is used and no merging takes place.
Available Commands:
current-context Displays the current-context
delete-cluster Delete the specified cluster from the kubeconfig
delete-context Delete the specified context from the kubeconfig
get-clusters Display clusters defined in the kubeconfig
get-contexts Describe one or many contexts
rename-context Renames a context from the kubeconfig file.
set Sets an individual value in a kubeconfig file
set-cluster Sets a cluster entry in kubeconfig
set-context Sets a context entry in kubeconfig
set-credentials Sets a user entry in kubeconfig
unset Unsets an individual value in a kubeconfig file
use-context Sets the current-context in a kubeconfig file
view Display merged kubeconfig settings or a specified kubeconfig file
Usage:
kubectl config SUBCOMMAND [options]
Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).
enmac:kubeflow-codelab idownard$ kubectl config view
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: REDACTED
server: https://35.203.189.104
name: gke_mapr-demos_us-west1-a_kubeflow-codelab
- cluster:
certificate-authority-data: REDACTED
server: https://35.233.182.115
name: gke_mapr-demos_us-west1-b_persistent-disk-tutorial
- cluster:
certificate-authority-data: REDACTED
server: https://35.184.58.50
name: gke_my-project-1498690429406_us-central1-a_kubeflow-codelab
contexts:
- context:
cluster: gke_mapr-demos_us-west1-a_kubeflow-codelab
user: gke_mapr-demos_us-west1-a_kubeflow-codelab
name: gke_mapr-demos_us-west1-a_kubeflow-codelab
- context:
cluster: gke_mapr-demos_us-west1-b_persistent-disk-tutorial
user: gke_mapr-demos_us-west1-b_persistent-disk-tutorial
name: gke_mapr-demos_us-west1-b_persistent-disk-tutorial
- context:
cluster: gke_my-project-1498690429406_us-central1-a_kubeflow-codelab
user: gke_my-project-1498690429406_us-central1-a_kubeflow-codelab
name: gke_my-project-1498690429406_us-central1-a_kubeflow-codelab
current-context: gke_mapr-demos_us-west1-a_kubeflow-codelab
kind: Config
preferences: {}
users:
- name: gke_mapr-demos_us-west1-a_kubeflow-codelab
user:
auth-provider:
config:
access-token: ya29.Gl0QBvm-FiXicvtlMdouZ93rurHWaw5orXvWg54h1vUW6rXdzL1tuCX-6tCrtHX0vqmbLKs-mBQeG_NvwbL1iQZEJXeQK4ilaoB7CvmHwz5n6OR_n54ymOP9-GPoDog
cmd-args: config config-helper --format=json
cmd-path: /Users/idownard/Downloads/google-cloud-sdk/bin/gcloud
expiry: 2018-09-06T19:13:26Z
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
- name: gke_mapr-demos_us-west1-b_persistent-disk-tutorial
user:
auth-provider:
config:
access-token: ya29.Gl0HBmy1izfa9ISFgGgGQxBs9qsMCJL8HpYVyXFvewk6LyfnsBE4E3KkYKL0XoBO0XD4Tu_mJWuPobCwAKHXtLfGlVxIifZmzM7DAoIP9Ij004yB_27QPMzhmaVWjaU
cmd-args: config config-helper --format=json
cmd-path: /Users/idownard/Downloads/google-cloud-sdk/bin/gcloud
expiry: 2018-08-28 18:18:23
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
- name: gke_my-project-1498690429406_us-central1-a_kubeflow-codelab
user:
auth-provider:
config:
access-token: ya29.Gl0CBqKr52D-YvbFbczbWFyZvvE6X5gwxxOt5u5MP-tUFzC6Yj4b4XW2QEjVQSXpIo3PiBJMtbcoBBLPRxxUF8fJpAY-dv7ZqYo_zQcvOiHhKPRDSKxao89ekcigwFo
cmd-args: config config-helper --format=json
cmd-path: /Users/idownard/Downloads/google-cloud-sdk/bin/gcloud
expiry: 2018-08-23 04:02:16
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment